SMTP Error

More
4 months 1 week ago #157251 by jltrussart11
jltrussart11 created the topic: SMTP Error
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!
Attachments:

Please Log in to join the conversation.

More
3 months 4 weeks ago - 3 months 4 weeks ago #157543 by jltrussart11
jltrussart11 replied the 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.
<?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.
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: 3 months 4 weeks ago by jltrussart11.

Please Log in to join the conversation.

More
3 months 2 weeks ago #157846 by DenisChenu
DenisChenu replied the 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 (or search sondages pro).
An error happen ? Before make a new topic : remind the Debug mode .

Please Log in to join the conversation.

More
1 day 4 hours ago #161599 by jltrussart11
jltrussart11 replied the 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!

Please Log in to join the conversation.

More
14 hours 13 minutes ago #161617 by jelo
jelo replied the 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.
/**
 * 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 following user(s) said Thank You: jltrussart11

Please Log in to join the conversation.

More
13 hours 21 minutes ago #161620 by jltrussart11
jltrussart11 replied the topic: SMTP Error
Thanks for your precious help! I better understand the complexity!

Could you suggest me some thirdparty tools to try?

Thanks!

Please Log in to join the conversation.

More
12 hours 54 minutes ago #161622 by jelo
jelo replied the 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

Please Log in to join the conversation.

More
12 hours 45 minutes ago #161624 by jltrussart11
jltrussart11 replied the 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!

Please Log in to join the conversation.

More
12 hours 26 minutes ago #161625 by jelo
jelo replied the 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 following user(s) said Thank You: jltrussart11

Please Log in to join the conversation.

More
12 hours 20 minutes ago #161627 by jltrussart11
jltrussart11 replied the 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?

Please Log in to join the conversation.

More
12 hours 1 minute ago #161631 by holch
holch replied the 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'm not a LimeSurvey GmbH member. I answer at the LimeSurvey forum in my spare time. No support via private message.
Some helpful links: Manual (EN) | Question Types | Workarounds
The following user(s) said Thank You: jltrussart11

Please Log in to join the conversation.

More
11 hours 34 minutes ago #161633 by jltrussart11
jltrussart11 replied the 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.

Please Log in to join the conversation.

More
11 hours 27 minutes ago #161634 by jelo
jelo replied the topic: SMTP Error

holch wrote: I don't see how this would be possible with Jelos method.

Possible, but the additional work and delay of sending out confirmation mails via the thirdparty tool is not practical. If such things are needed, I would invest in a good hosting plan and get the SMTP mailing via Limesurvey running. Or rent a package via Limesurvey.org.

Please Log in to join the conversation.

More
11 hours 20 minutes ago #161635 by jelo
jelo replied the topic: SMTP Error

jltrussart11 wrote: Do you think I could develop a plugin for that?

How should we know if you can write a plugin for LimeSurvey?
Your current issue is web-administration issue. You still can run into the same issue with the plugin.

Is your Limesurvey installation accessible via https://? Do you have a valid SSL-certificate running on your webspace?

Please Log in to join the conversation.

Start now!

Just create your account and start using Limesurvey today.

Register now
Join our Newsletter!