SignUpAssistant An error occurred while sending an email

Post here your questions about SFS2X. Here we discuss all server-side matters. For client API questions see the dedicated forums.

Moderators: Lapo, Bax

nahmeegaming
Posts: 4
Joined: 23 May 2019, 11:42

SignUpAssistant An error occurred while sending an email

Postby nahmeegaming » 13 Jun 2019, 12:46

Hi,
I'm using SFS2x 2.13.5 linux on Docker.
I'm working SignUpAssistant, I have set up the server extension and Postgres database already.
The registration is working properly. Create a row on database with all the information and activation code.

Code: Select all

suac.getConfig().emailResponse.isActive = true;
suac.getConfig().emailResponse.fromAddress = "contact@mydomain.com";
suac.getConfig().emailResponse.subject = "Thanks for signing up";
suac.getConfig().emailResponse.template = "AuthEmailTemplates/SignUpConfirmation.html";

But I have problem with SMTP mail server. I got

Code: Select all

WARN  [pool-4-thread-1] signup.SignUpAssistant     - An error occurred while sending an email to: contact@mydomain.com -- javax.mail.MessagingException: Could not connect to SMTP host: smtp.sendgrid.net, port: 25, response: 554

I tried sendgrid and mailgun also got the same error. I tried port 465 I got

Code: Select all

javax.mail.MessagingException: Could not connect to SMTP host: smtp.sendgrid.net, port: 465, response: -1

I tried using the cretencial on this website https://www.smtper.net/, sendgrid smtp server is working and able to send email.

Then I tried installing SFS2X Windows on the machine and using the same config, I also can't connect to the smtp server and got the same error just one more line.

Code: Select all

javax.mail.MessagingException: Could not connect to SMTP host: smtp.sendgrid.net, port: 465;
  nested exception is:
        java.net.ConnectException: Connection refused: connect
       

Code: Select all

javax.mail.MessagingException: Could not connect to SMTP host: smtp.sendgrid.net, port: 25;
  nested exception is:
        java.net.ConnectException: Connection refused: connect
       

I work on it for couple of days already, can you help me guild through the problem?
Thank you very much.
User avatar
Lapo
Site Admin
Posts: 23027
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: SignUpAssistant An error occurred while sending an email

Postby Lapo » 13 Jun 2019, 13:51

Hi,
if you are certain that the SMTP server host/port and relative credentials are configured correctly I would recommend checking if you have any firewall rules preventing the connection to the server.

Cheers
Lapo
--
gotoAndPlay()
...addicted to flash games
nahmeegaming
Posts: 4
Joined: 23 May 2019, 11:42

Re: SignUpAssistant An error occurred while sending an email

Postby nahmeegaming » 13 Jun 2019, 15:35

Hi thank you for your response.
The credential are correct. I copied from server.xml to test and it works. I got the email.
Image
Image
Image
Then I turn off the firewall. and allow everything from sfs2x still I got this error.

Code: Select all

Failed sending email: { Email To: hr@mydomain.com, From: contact@mydomain.com, Subject: Thanks for signing up }, javax.mail.MessagingException: Could not connect to SMTP host: smtp.sendgrid.net, port: 25;
  nested exception is:
        java.net.ConnectException: Connection refused: connect

Image
Image

Now I'm stuck.
User avatar
Lapo
Site Admin
Posts: 23027
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: SignUpAssistant An error occurred while sending an email

Postby Lapo » 13 Jun 2019, 15:45

Hi,
the message saying that the connection is refused may indicate that the SMTP server has a black-list of IP ranges that are not allowed to connect. Typically these are used defend from known IP ranges used by spammers but sometimes these filters are too coarse and they end up blocking legitimate users.

In any case if you want you can send us the credentials you're using and we can analyze the problem a little bit further.
If you decide to do so, send us an email with the details to our support@... email box, with a reference to this discussion.

Thanks.
Lapo

--

gotoAndPlay()

...addicted to flash games
nahmeegaming
Posts: 4
Joined: 23 May 2019, 11:42

Re: SignUpAssistant An error occurred while sending an email

Postby nahmeegaming » 13 Jun 2019, 18:12

Thanks for your guide, the problem solved.
nahmeegaming
Posts: 4
Joined: 23 May 2019, 11:42

Re: SignUpAssistant An error occurred while sending an email

Postby nahmeegaming » 14 Jun 2019, 03:16

Hi
After I set up Digitalocean and send SMTP on port 587. I can send the email. But if I develop on localhost it still error when sending email through port 587. Here is the error.

Code: Select all

javax.mail.MessagingException: Can't send command to SMTP host;
[33msmartfox    | [0m   nested exception is:
[33msmartfox    | [0m javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertP
athBuilderException: unable to find valid certification path to requested target


Can you guide me on how to solve this?
User avatar
Lapo
Site Admin
Posts: 23027
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: SignUpAssistant An error occurred while sending an email

Postby Lapo » 14 Jun 2019, 08:18

I've already replied to the same question via email. Let's keep the conversation in one place.
Thanks
Lapo

--

gotoAndPlay()

...addicted to flash games
User avatar
HTCraft
Posts: 27
Joined: 28 Jun 2018, 09:51
Location: Moscow, Russia
Contact:

Re: SignUpAssistant An error occurred while sending an email

Postby HTCraft » 01 Dec 2019, 07:34

nahmeegaming wrote: Can you guide me on how to solve this?

Look at https://www.java-samples.com/showtutorial.php?tutorialid=210

Return to “SFS2X Questions”

Who is online

Users browsing this forum: SmartfoxEnjoyer and 116 guests