Welcome to the LimeSurvey Community Forum

Ask the community, share ideas, and connect with other LimeSurvey users!

SMTP Error

  • jltrussart11
  • jltrussart11's Avatar Topic Author
  • Offline
  • Senior Member
  • Senior Member
More
6 years 8 months ago #157251 by jltrussart11
SMTP Error was created by jltrussart11
Hello,

I' using the latest version of LimeSurvey and i'm trying to configure the SMTP to use with Sendinblue.

I've tested theses credentials in a php script on my server and I'm able to send and receive mail. My server seems to be well configured.

When I send an invitation, I got this message:

2017-07-30 14:35:08 SMTP ERROR: Failed to connect to server: Connection refused (111)
2017-07-30 14:35:08 Échec de la connexion SMTP. github.com/PHPMailer/PHPMailer/wiki/Troubleshooting

Any idea what's the problem? Is there a way to have more information than SMTP error 111?

Thanks a lot!
The topic has been locked.
  • jltrussart11
  • jltrussart11's Avatar Topic Author
  • Offline
  • Senior Member
  • Senior Member
More
6 years 8 months ago - 6 years 8 months ago #157543 by jltrussart11
Replied by jltrussart11 on topic SMTP Error
Hello folks,

I've managed to get details to the error.


I've tried with this PHP code to connect via PHPMailer.
Code:
<?php
require 'application/third_party/phpmailer/class.phpmailer.php';
require 'application/third_party/phpmailer/class.smtp.php';
$mail = new PHPMailer;
$mail->SMTPDebug = 4; // Enable verbose debug output
$mail->isSMTP(); // Set mailer to use SMTP
$mail->Host = 'smtp-relay.sendinblue.com'; // Specify main and backup SMTP servers
$mail->SMTPAuth = true; // Enable SMTP authentication
$mail->Username = '***'; // SMTP username
$mail->Password = '***'; // SMTP password
$mail->SMTPSecure = 'tls'; // Enable TLS encryption, `ssl` also accepted
$mail->Port = 587; // TCP port to connect to
 
$mail->setFrom('info@vecteursleviers.com', 'Mailer');
$mail->addAddress('jltrussart@gmail.com', 'Joe User'); // Add a recipient
$mail->isHTML(true); // Set email format to HTML
$mail->Subject = 'Here is the subject';
$mail->Body = 'This is the HTML message body <b>in bold!</b>';
$mail->AltBody = 'This is the body in plain text for non-HTML mail clients';
if(!$mail->send()) {
echo 'Message could not be sent.';
echo 'Mailer Error: ' . $mail->ErrorInfo;
} else {
echo 'Message has been sent';
}
?>

and I get this error.
Code:
2017-08-13 11:38:20  Connection: opening to smtp-relay.sendinblue.com:587, timeout=300, options=array ( ) 2017-08-13 11:38:22  Connection: Failed to connect to server. Error number 2. "Error notice: stream_socket_client(): unable to connect to smtp-relay.sendinblue.com:587 (Connection refused) 2017-08-13 11:38:22  SMTP ERROR: Failed to connect to server: Connection refused (111) 2017-08-13 11:38:22  SMTP connect() failed. https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting Message could not be sent.Mailer Error: SMTP connect() failed. https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting

Port 587 is open on my server. I also test my SMTP details in a free LimeSurvey Pro and it's working.

Any idea what could I test on my server to make SMTP works? Do I need to change my Hosting server to something like BlueHost?
Last edit: 6 years 8 months ago by jltrussart11.
The topic has been locked.
  • DenisChenu
  • DenisChenu's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
6 years 7 months ago #157846 by DenisChenu
Replied by DenisChenu on topic SMTP Error
A lot pof hoster have whitelist for smtp connexion. You must see for start with your hoster i think.

Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand , plugin development .
I don't answer to private message.
The topic has been locked.
  • jltrussart11
  • jltrussart11's Avatar Topic Author
  • Offline
  • Senior Member
  • Senior Member
More
6 years 4 months ago #161599 by jltrussart11
Replied by jltrussart11 on topic SMTP Error
Sorry for the delay before posting this update. I've made severals tests to find a solution, but, sadly, did'nt resolve this issue.


My host tells me that nothing is blocked and that they have no blacklist.

I've test others email marketing provider (sendgrid), other host (Bluehost, that's been recommend on LimeSurvey site) and settings and i'm still stuck.

It's seems that servers do not allow SMTP. The developpers that I've hired to analyse this tell me that theses are commons settings for many web host in Québec, Canada.

It's frustrating because everything works when I use the PHP options instead of SMTP. I just want to use a Email marketing solution to avoid that my email are been marked as spam.

Doe anybody have configured the SMTP successfully? Does the only solution is to bypass the email settings of LimeSurvey and use the API to developp a scrit to send the invitation with the tokens, the reminder and the confirmation?

Thanks a lot for your precious time and help! I really appreciate it!
The topic has been locked.
More
6 years 4 months ago #161617 by jelo
Replied by jelo on topic SMTP Error

jltrussart11 wrote: It's seems that servers do not allow SMTP.

The error message from phpmailer is triggered for many issues. The statement of your provider can be true.

It can be a issue with the OpenSSL-Library/PHP extension. It can be a issue around the SSL-cert. PHP is not tighter on validating SSL-certs.

Since a lot of software is on the stack, it can be very nasty to debug the mailing part.

A tricky thing with phpmailer is that some automatic routines are in place. E.g tls is tried even when you set transportencryption to SSL or none.
Code:
/**
 * Whether to enable TLS encryption automatically if a server supports it,
 * even if `SMTPSecure` is not set to 'tls'.
 * Be aware that in PHP >= 5.6 this requires that the server's certificates are valid.
 * @var boolean
 */
public $SMTPAutoTLS = false;


It is working for LimeSurveyuser. I have tested that too and it worked. But on a shared webserver it can be more difficult to debug.

But personally I never used the mailing part of LimeSurvey. I always use thirdparty tools (offline), since I don't want to expose to much data on webservers and handling of mailing is easier with other tools.

The meaning of the word "stable" for users
www.limesurvey.org/forum/development/117...ord-stable-for-users
The following user(s) said Thank You: jltrussart11
The topic has been locked.
  • jltrussart11
  • jltrussart11's Avatar Topic Author
  • Offline
  • Senior Member
  • Senior Member
More
6 years 4 months ago #161620 by jltrussart11
Replied by jltrussart11 on topic SMTP Error
Thanks for your precious help! I better understand the complexity!

Could you suggest me some thirdparty tools to try?

Thanks!
The topic has been locked.
More
6 years 4 months ago #161622 by jelo
Replied by jelo on topic SMTP Error
Since I used my own mailserver, a simple software alone won't do the trick for you.
You already mentioned SendGrid. Beside the mailer API, they offer the management of mailing too.
You can try that.
www.ventureharbour.com/email-marketing-software-tools-one-best/

When using hosted, third party mail tools, you need to check for legal issues as well. You're uploading personal data (e.g. email-address) to a third party.
So you might want to keep the complete data (except emails) on your harddisk.
Then you can use tools like this: www.sendblaster.com/en/desktop-e-mail-ma...ng-software-features

The meaning of the word "stable" for users
www.limesurvey.org/forum/development/117...ord-stable-for-users
The topic has been locked.
  • jltrussart11
  • jltrussart11's Avatar Topic Author
  • Offline
  • Senior Member
  • Senior Member
More
6 years 4 months ago #161624 by jltrussart11
Replied by jltrussart11 on topic SMTP Error
Thanks for the ressources.

Using a third party tools is what I exactly want to do. As explain a the begining of this thread, the SMTP settings in /index.php/admin/globalsettings#email give me the SMTP ERROR: Failed to connect to server: Connection refused (111)....I'm sure that my credentials are good, so I've tested in Php and get the same error.

Thanks again for your precious help!
The topic has been locked.
More
6 years 4 months ago #161625 by jelo
Replied by jelo on topic SMTP Error

jltrussart11 wrote: Using a third party tools is what I exactly want to do.

That is not what I meant.
I have no connection between LimeSurvey and the mailing process. In LimeSurvey you might create a token list. That token list is imported into the thirdparty tool (offline or online) and the mailing and rebounce process is done via that third party tool. From time to time the tokenlist is exported again from LimeSurvey to prepare a reminder in the third party tool.
There is more manual work involved, but you have no issues with LimeSurvey or the underlying hostinginfrastructure.

The meaning of the word "stable" for users
www.limesurvey.org/forum/development/117...ord-stable-for-users
The following user(s) said Thank You: jltrussart11
The topic has been locked.
  • jltrussart11
  • jltrussart11's Avatar Topic Author
  • Offline
  • Senior Member
  • Senior Member
More
6 years 4 months ago #161627 by jltrussart11
Replied by jltrussart11 on topic SMTP Error
Great idea! Could it also works for the confirmation email if it includes expression manager computed files based on the answers of the participants?
The topic has been locked.
  • holch
  • holch's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
6 years 4 months ago #161631 by holch
Replied by holch on topic SMTP Error
No, of course not. If you are processing the mails outside of Limesurvey you will not be able to use the features of Limesurvey.

And of course the confirmation email is something inherrent of Limesurvey and sent automatically. I don't see how this would be possible with Jelos method.

I answer at the LimeSurvey forum in my spare time, I'm not a LimeSurvey GmbH employee.
No support via private message.

The following user(s) said Thank You: jltrussart11
The topic has been locked.
  • jltrussart11
  • jltrussart11's Avatar Topic Author
  • Offline
  • Senior Member
  • Senior Member
More
6 years 4 months ago #161633 by jltrussart11
Replied by jltrussart11 on topic SMTP Error
Thanks you everyone for your precious help! Your engagement is one of the main reason that I love LimeSurvey!

Do you think I could develop a plugin for that?

The plugin would use the API of the thirdparty, like sendinblue, to send the invitation, reminder and confirmation. It would bypass the phpmailer and smtp settings.
The topic has been locked.

Lime-years ahead

Online-surveys for every purse and purpose