Need help in configuring the SMTP

Hi Team,

I am using AWS SMTP end point to send the email and it is working fine.

Now I would like to integrate it in
cuba but I am not getting how to set this property “SLL: True” in cuba

My smtp details are
SMTP host: email-smtp.us-east-1.amazonaws.com
Port: 25
Use SLL: True
Use Authentication: True
Authentication name: *****************
Authentication password : *************************************************
Email from: no-reply@*******.com

Error log attached smtp error.txt (29.7 KB)

see https://doc.cuba-platform.com/manual-6.7/email_sending_properties.html

please, use the built-in search in the online docs for trivial things like this, and do not rely on forum members to do the search for you, or your post will likely be ignored at all… :smirk:

P.

Hi,
Have you solved the problem?
There is an ability to test platfrom emailer in the running application.
Open Administration -> JMX Console and find “Emailer”. There you can define connection params and send test emails.
image

Yes problem is solved.
System antivirus is blocking the email functionality, but I disabled Avast antivirus in my system then it worked.
I have integrated this email in my custom web application from service method

EmailInfo emailInfo = new EmailInfo(
        		recipientAddress,
        		subject,
                null,
                "com/company/*****/email/set_new_password.ftl",
                templateParameters
        );
emailService.sendEmail(emailInfo);

it is working fine.

But from JMX console it is not working, I have attached the log below
jmx.com.haulmont.cuba.core.jmx.Emailer-sendTestEmail-11_20_13.log (9.7 KB)

Hi,
Could you inspect your connection params? Is there some strange value (maybe with the “=” symbol)?

Everything is correct only I have “-” in from address is that the issue?

cuba.email.fromAddress = no-reply@company.com

cuba.schedulingActive = true
cuba.email.fromAddress = no-reply@******.com
cuba.email.smtpHost = email-smtp.us-east-1.amazonaws.com
cuba.email.smtpPort = 25
cuba.email.smtpStarttlsEnable = true
cuba.email.smtpAuthRequired = true
cuba.email.smtpUser = *************
cuba.email.smtpPassword = *********************************

Hi,
The error does not occur with other SMTP services.
It seems, Amazon considers the test email incorrect.

We will check the test email generation. See the corresponding Youtrack issue.
Thank you.

1 Like

Thanks, Please keep us posted if any resolution.

Hi,

Just for your information.

I have created a new SMTP Amazon without putting ‘-’ in the from address but still the same issue I am facing.

I feel the host name has got special characters which is causing the problem.
Server Name:(Host) email-smtp.us-east-1.amazonaws.com

Hello!

This issue will be fixed in this ticket: YouTrack.

But you are able to fix it by yourself.

Firstly, you should replace the implementation of com.haulmont.cuba.core.app.EmailSenderAPI - com.haulmont.cuba.core.app.EmailSender.
Secondly, you should override createAttachmentPart method and do this fix:

// Wrap 'name' parameter value
String contentTypeValue = String.format("%s; charset=%s; name=%s", mimeType, charset, encodedFileName);
// In this way:
String contentTypeValue = String.format("%s; charset=%s; name=\"%s\"", mimeType, charset, encodedFileName);

Best regards,
Daniil.