Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,360,615
Community Members
 
Community Events
168
Community Groups

SMTP- not from SPAM

Hi all,

 

I have a script in REST Endpoint that sends a mail.

This mail is sent by spam, and the regular send mail (from listeners) send the mail without spam (send a custom mail)

 

How can I change my REST Endpoint script so the mail will be sent without spam?

 

This is my script:

def sendEmail(String emailAddr, String subject, Object body, String from) {
def mailServer = ComponentAccessor.getMailServerManager().getDefaultSMTPMailServer();


//if (mailServer) {
try{
Email email = new Email(emailAddr)
email.setMimeType("text/html")
email.setSubject(subject)
email.setBody(body.toString())
email.setFrom(from)
mailServer.send(email)
log.debug("Mail sent")
}

catch(Exception e) {
log.warn("Please make sure that a valid mailServer is configured")
log.warn e;
}
}

 

Thank you!

Daniel

1 answer

0 votes

What do you mean by "mail is sent by spam"?  Do you mean you have an account called spam?  Or that your mail servers are identifying mail as spam?

Hi Noc,

I meant using Jira API,

I already succeed, Thank you!

 

Email em = new Email(emailAddr);

em.setBody(body.toString());

em.setMimeType("text/html");

em.setSubject(subject)

SingleMailQueueItem smqi = new SingleMailQueueItem(em);

ComponentAccessor.getMailQueue().addItem(smqi)

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Jira

Online AMA this week: Your project management questions answered by Jira Design Lead James Rotanson

We know that great teams require amazing project management chops. It's no surprise that great teams who use Jira have strong project managers, effective workflows, and secrets that bring planning ...

196 views 1 6
Read article

Atlassian Community Events