Announcement

#1 2014-11-02 14:00:16

hvalverde
Member
United Kingdom
2014-11-02
2

[SOLUTION] Connect to SMTP using TLS or SSL

Hi all,

I've seen a number of posts talking about how to send emails from Piwigo using TLS or SSL but I didn't see any solution which allow the use of such protocols.

As I'm a new Piwigo user, I don't know whether the functionality I found has been implemented in the last version of the gallery or was there before. Anyway, to configure your SMTP server add the following lines to the file "/<your_piwigo_path>/local/config/config.inc.php". Create the file if it doesn't exist:

<?php

$conf['smtp_host']='smtp.server.com;  // Notice I didn't indicate the port
$conf['smtp_user']='user';
$conf['smtp_password']='password';
$conf['smtp_secure']='tls'; // you can put ssl instead

?>

I hope it's useful your you all.

Best regards

Piwigo version: 2.7.1
PHP version:  5.5.9-1ubuntu4
MySQL version: 5.6.19-log
Piwigo URL: http://piwigo.hval.es
Twitter: @hvpareja

Offline

 

#2 2014-11-04 19:08:31

baataboom
Member
2014-10-28
17

Re: [SOLUTION] Connect to SMTP using TLS or SSL

What if we want neither TLS or SSL? I'd rather rely on either the local systems email server (and let it be responsible for secure access) or on a nearby mail server. SSL or TLS would be overkill for my use.

Is there any documentation beyond that in config_default.inc.php? I've tried setting the host to 2 valid mail servers (localhost and the IP of another nearby host). Since I'm not using SSL or TLS I left the smtp_user, smtp_pass, and smtp_secure alone (i.e. '', '', and null respectively ).

Once again I see no evidence of any email activity based on client or server logs available. And I see no evidence of any attempt.

Finally, while the new user does get register when they request it, the receive a blank window as a result.

Still puzzled after searching for anything related to PWG and it's use of email.

Mark

Offline

 

#3 2014-11-04 20:12:48

hvalverde
Member
United Kingdom
2014-11-02
2

Re: [SOLUTION] Connect to SMTP using TLS or SSL

You're right. I neither couldn't see any documentation beyond PWG and its mail handling. However, if you know just a bit of PHP, you can have a look to the library it implements to deal with emails, phpmailer.

Send emails via SMTP is something that has been discussed before, the missed point was the way to send TLS or SSL. To avoid security layers, just don't define the smtp_secure variable and specify a port in the url:

<?php

$conf['smtp_host']='smtp.server.com:25';  // Notice I DO indicate the port
$conf['smtp_user']='user';
$conf['smtp_password']='password';
//$conf['smtp_secure']='tls'; // You DON'T need this

?>

Best regards

Offline

 

#4 2014-11-04 20:55:00

flop25
Piwigo Team
2006-07-06
6811

Re: [SOLUTION] Connect to SMTP using TLS or SSL

emails are very touchy on webservers ; the first thing to do would be to try the mail function in command line via ssh


To get a better help : Politeness like Hello-A link-Your past actions precisely described
Check my extensions : more than 30 available
who I am and what I do : http://fr.gravatar.com/flop25
My gallery : an illustration of how to integrate Piwigo in your website

Offline

 

#5 2014-11-05 18:43:05

baataboom
Member
2014-10-28
17

Re: [SOLUTION] Connect to SMTP using TLS or SSL

Thanks to you both. Perhaps I should start another thread since the subject specifies TLS or SSL and I'd rather take the simpler approach and do neither.

I've sent email from my PWG host using the command-line mailx command. There are no problems with that. And that mail activity is reflected in the system's mail logs.

Unfortunately, I see no evidence of PWG doing anything that might be logged as mail-related on the PWG machine or even on a separate mail server (when testing that way).

It looks like I'll need to add some debugging to  functions_mail.inc.php to see what's going on. Or I could see what setting $conf['debug_mail'] might reveal. I'll also look at the phpmailer source code.

In any case, I thought the user that was registering would have been presented either a success or failure indicator (in browser). But the successful registration reveals nothing to the user.

Mark

Last edited by baataboom (2014-11-05 18:55:10)

Offline

 

#6 2016-06-11 15:00:12

Simon Clark
Guest

Re: [SOLUTION] Connect to SMTP using TLS or SSL

I tried doing the edits recommended here but was still stuck until I enabled mailparse in cpanel PHP Selector | extensions.
Cleaned out the setting I added with LocalFiles Editor and it all work now.
Thanks for a great product.

 

Board footer

Powered by FluxBB

github twitter facebook google+ newsletter Donate Piwigo.org © 2002-2018 · Contact