SMTP not working

classic Classic list List threaded Threaded
18 messages Options
iko
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

SMTP not working

iko
Hi,

It is a known problem to get smtp to work. What I and many others did, is to change smtp to sendmail in class.phpmailer.php. This means that smtp is turned off and all mails are send with php mail() function. Is there any fix to get smtp to work?
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: SMTP not working

Alan Lord (News)
Replace the (very old and obsolete) vtiger supplied
class.{smtp,phpmailer}.php files with new ones from the project on github.

You will have to manually include the smtp class as it is now designed
for Composer but other that I have found that it is a drop-in
replacement and fixes most issues.

HTH

Al


On 05/04/17 15:10, iko wrote:

> Hi,
>
> It is a known problem to get smtp to work. What I and many others did, is to
> change smtp to sendmail in class.phpmailer.php. This means that smtp is
> turned off and all mails are send with php mail() function. Is there any fix
> to get smtp to work?
>
>
>
> --
> View this message in context: http://vtiger-crm.2324883.n4.nabble.com/SMTP-not-working-tp20617.html
> Sent from the vtigercrm-developers mailing list archive at Nabble.com.
> _______________________________________________
> http://www.vtiger.com/
>


_______________________________________________
http://www.vtiger.com/
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: SMTP not working

Holbok István

and set the necessary settings, like utf-8 comparing with the vtiger supplied class.{smtp,phpmailer}.php


2017.04.05. 16:42 keltezéssel, Alan Lord írta:
Replace the (very old and obsolete) vtiger supplied class.{smtp,phpmailer}.php files with new ones from the project on github.

You will have to manually include the smtp class as it is now designed for Composer but other that I have found that it is a drop-in replacement and fixes most issues.

HTH

Al


On 05/04/17 15:10, iko wrote:
Hi,

It is a known problem to get smtp to work. What I and many others did, is to
change smtp to sendmail in class.phpmailer.php. This means that smtp is
turned off and all mails are send with php mail() function. Is there any fix
to get smtp to work?



--
View this message in context: http://vtiger-crm.2324883.n4.nabble.com/SMTP-not-working-tp20617.html
Sent from the vtigercrm-developers mailing list archive at Nabble.com.
_______________________________________________
http://www.vtiger.com/



_______________________________________________
http://www.vtiger.com/




_______________________________________________
http://www.vtiger.com/
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: SMTP not working

Manuel
In reply to this post by Alan Lord (News)
Alan, can you elaborate a bit more your explanation?
I see no diference between file names.

I don’t think it’s a drop replacement only because of the names of the classes that are now started like “mailSend” instead old files like “MailSend"

Thanks
Manuel

No dia 05/04/2017, às 15:42, Alan Lord <[hidden email]> escreveu:

Replace the (very old and obsolete) vtiger supplied class.{smtp,phpmailer}.php files with new ones from the project on github.

You will have to manually include the smtp class as it is now designed for Composer but other that I have found that it is a drop-in replacement and fixes most issues.

HTH

Al


On 05/04/17 15:10, iko wrote:
Hi,

It is a known problem to get smtp to work. What I and many others did, is to
change smtp to sendmail in class.phpmailer.php. This means that smtp is
turned off and all mails are send with php mail() function. Is there any fix
to get smtp to work?



--
View this message in context: http://vtiger-crm.2324883.n4.nabble.com/SMTP-not-working-tp20617.html
Sent from the vtigercrm-developers mailing list archive at Nabble.com.
_______________________________________________
http://www.vtiger.com/



_______________________________________________
http://www.vtiger.com/


_______________________________________________
http://www.vtiger.com/
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: SMTP not working

Alan Lord (News)
On 05/04/17 22:42, Manuel wrote:
> Alan, can you elaborate a bit more your explanation?
> I see no diference between file names.
>
> I don’t think it’s a drop replacement only because of the names of the
> classes that are now started like “*mailSend*” instead old files like
> “*MailSend*"

Err, well. On a customer's 5.4.0 system recently I was having loads of
problems trying to get mail sending to work. I replaced the two class
files with new ones from github, added a require_once() line at the top
of the phpmailer class to include the smtp class and it all started working.

HTH

Al



_______________________________________________
http://www.vtiger.com/
iko
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: SMTP not working

iko
In reply to this post by Holbok István
I have tried to put the to new files in and setting require_once('modules/Emails/class.smtp.php'); in the new class.phpmailer.php file. But had no success in getting smtp to work in VT 6.5.

Istvan, what should be done to 'set the necessary settings, like utf-8 comparing with the vtiger supplied class.{smtp,phpmailer}.php' ?

And thank you for your help, it is much appreciated
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: SMTP not working

Holbok István

In the file class.phpmailer.php downloaded from the GitHub Master about the line 48 you will find the charset defintion. It is by default is iso, but we need utf-8. In the vtiger original this definition is:   public $CharSet  = 'UTF-8';

I highlighted it with red.

class PHPMailer
{
    /**
     * The PHPMailer Version number.
     * @var string
     */
    public $Version = '5.2.22';

    /**
     * Email priority.
     * Options: null (default), 1 = High, 3 = Normal, 5 = low.
     * When null, the header is not set at all.
     * @var integer
     */
    public $Priority = null;

    /**
     * The character set of the message.
     * @var string
     */
    public $CharSet = 'iso-8859-1';

The vtiger uses other settings also, but the utf-8 is the main.

In any vtiger 6.x system replacing the old mailer class files, including the require smtp class at the top will work the change. I also uses it as Alan in all of my systems.
The last version of the mailer classes can be downloaded from here: https://github.com/PHPMailer/PHPMailer

And here is the test code of the SMTP connection: https://github.com/PHPMailer/PHPMailer/blob/master/examples/smtp.phps
Inserting this piece of the code, setting credentials inline, and turning on the SMTP debug mode, you will able to see what is happening.

Once I had run into trouble with a vtiger smtp connection and the debug showed the real why: there was a white space added to the password. I spent 3 hours to debug it :-(
Sometimes it is simple like a stone.

Regards:
Istvan

2017.04.06. 10:32 keltezéssel, iko írta:
I have tried to put the to new files in and setting
require_once('modules/Emails/class.smtp.php'); in the new
class.phpmailer.php file. But had no success in getting smtp to work in VT
6.5. 

Istvan, what should be done to 'set the necessary settings, like utf-8
comparing with the vtiger supplied class.{smtp,phpmailer}.php' ?

And thank you for your help, it is much appreciated



--
View this message in context: http://vtiger-crm.2324883.n4.nabble.com/SMTP-not-working-tp20617p20624.html
Sent from the vtigercrm-developers mailing list archive at Nabble.com.
_______________________________________________
http://www.vtiger.com/




_______________________________________________
http://www.vtiger.com/
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: SMTP not working

Manuel
Things like this could be proposed, but I guess vt team will never accept this kind of changes.

Best Regards.

Manuel

No dia 06/04/2017, às 18:47, Holbok István <[hidden email]> escreveu:

In the file class.phpmailer.php downloaded from the GitHub Master about the line 48 you will find the charset defintion. It is by default is iso, but we need utf-8. In the vtiger original this definition is:   public $CharSet  = 'UTF-8';

I highlighted it with red.

class PHPMailer
{
    /**
     * The PHPMailer Version number.
     * @var string
     */
    public $Version = '5.2.22';

    /**
     * Email priority.
     * Options: null (default), 1 = High, 3 = Normal, 5 = low.
     * When null, the header is not set at all.
     * @var integer
     */
    public $Priority = null;

    /**
     * The character set of the message.
     * @var string
     */
    public $CharSet = 'iso-8859-1';

The vtiger uses other settings also, but the utf-8 is the main.

In any vtiger 6.x system replacing the old mailer class files, including the require smtp class at the top will work the change. I also uses it as Alan in all of my systems.
The last version of the mailer classes can be downloaded from here: https://github.com/PHPMailer/PHPMailer

And here is the test code of the SMTP connection: https://github.com/PHPMailer/PHPMailer/blob/master/examples/smtp.phps
Inserting this piece of the code, setting credentials inline, and turning on the SMTP debug mode, you will able to see what is happening.

Once I had run into trouble with a vtiger smtp connection and the debug showed the real why: there was a white space added to the password. I spent 3 hours to debug it :-(
Sometimes it is simple like a stone.

Regards:
Istvan

2017.04.06. 10:32 keltezéssel, iko írta:
I have tried to put the to new files in and setting
require_once('modules/Emails/class.smtp.php'); in the new
class.phpmailer.php file. But had no success in getting smtp to work in VT
6.5. 

Istvan, what should be done to 'set the necessary settings, like utf-8
comparing with the vtiger supplied class.{smtp,phpmailer}.php' ?

And thank you for your help, it is much appreciated



--
View this message in context: http://vtiger-crm.2324883.n4.nabble.com/SMTP-not-working-tp20617p20624.html
Sent from the vtigercrm-developers mailing list archive at Nabble.com.
_______________________________________________
http://www.vtiger.com/



_______________________________________________
http://www.vtiger.com/


_______________________________________________
http://www.vtiger.com/
iko
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: SMTP not working

iko
In reply to this post by Holbok István
Thank you, Istvan for your help. I had right files and UTF-8 was in place. But no luck getting smtp to work...

Here is what I get in debug message:

2017-04-07 07:30:32 Invalid address: (addAnAddress Reply-To): 2017-04-07 07:30:32 Connection: opening to smtp.office365.com:25, timeout=300, options=array ( ) 2017-04-07 07:30:32 Connection failed. Error #2: stream_socket_client(): unable to connect to smtp.office365.com:25 (No route to host) [/removed/modules/Emails/class.smtp.php line 294] 2017-04-07 07:30:32 SMTP ERROR: Failed to connect to server: No route to host (65) 2017-04-07 07:30:32 SMTP connect() failed. https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting 

And port should be 587. It is correct in vtiger_systems and I tested with putting it manually in class.phpmailer.php. But debug message remains the same with port 25.

Regarding the smtp.phps code. Where should I insert it? I'm sorry for my being inexperienced.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: SMTP not working

Christophe Humbert
Hello

You have a DNS issue No route to host

Kind Regards
Chris


On Fri, Apr 7, 2017 at 9:26 AM, iko <[hidden email]> wrote:
Thank you, Istvan for your help. I had right files and UTF-8 was in place.
But no luck getting smtp to work...

Here is what I get in debug message:

2017-04-07 07:30:32 Invalid address: (addAnAddress Reply-To): <a href="tel:2017-04-07" value="+35220170407">2017-04-07
07:30:32 Connection: opening to smtp.office365.com:25, timeout=300,
options=array ( ) 2017-04-07 07:30:32 Connection failed. Error #2:
stream_socket_client(): unable to connect to smtp.office365.com:25 (No route
to host) [/removed/modules/Emails/class.smtp.php line <a href="tel:294%5D%202017-04-07" value="+35229420170407">294] 2017-04-07
07:30:32 SMTP ERROR: Failed to connect to server: No route to host (65)
2017-04-07 07:30:32 SMTP connect() failed.
https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting

And port should be 587. It is correct in vtiger_systems and I tested with
putting it manually in class.phpmailer.php. But debug message remains the
same with port 25.

Regarding the smtp.phps code. Where should I insert it? I'm sorry for my
being inexperienced.



--
View this message in context: http://vtiger-crm.2324883.n4.nabble.com/SMTP-not-working-tp20617p20627.html
Sent from the vtigercrm-developers mailing list archive at Nabble.com.

_______________________________________________
http://www.vtiger.com/


_______________________________________________
http://www.vtiger.com/
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: SMTP not working

its4you
Hi all,

maybe you should consider updating the same files under cron directory
too ;)


Matus

Dňa 7. 4. 2017 o 10:03 Christophe Humbert napísal(a):

> Hello
>
> You have a DNS issue *No route to host*
>
> Kind Regards
> Chris
>
>
> On Fri, Apr 7, 2017 at 9:26 AM, iko
> <[hidden email]
> <mailto:[hidden email]>> wrote:
>
>     Thank you, Istvan for your help. I had right files and UTF-8 was in
>     place.
>     But no luck getting smtp to work...
>
>     Here is what I get in debug message:
>
>     2017-04-07 07:30:32 Invalid address: (addAnAddress Reply-To):
>     2017-04-07 <tel:2017-04-07>
>     07:30:32 Connection: opening to smtp.office365.com:25
>     <http://smtp.office365.com:25>, timeout=300,
>     options=array ( ) 2017-04-07 07:30:32 Connection failed. Error #2:
>     stream_socket_client(): unable to connect to smtp.office365.com:25
>     <http://smtp.office365.com:25> (No route
>     to host) [/removed/modules/Emails/class.smtp.php line 294]
>     2017-04-07 <tel:294%5D%202017-04-07>
>     07:30:32 SMTP ERROR: Failed to connect to server: No route to host (65)
>     2017-04-07 07:30:32 SMTP connect() failed.
>     https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting
>     <https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting>
>
>     And port should be 587. It is correct in vtiger_systems and I tested
>     with
>     putting it manually in class.phpmailer.php. But debug message
>     remains the
>     same with port 25.
>
>     Regarding the smtp.phps code. Where should I insert it? I'm sorry for my
>     being inexperienced.
>
>
>
>     --
>     View this message in context:
>     http://vtiger-crm.2324883.n4.nabble.com/SMTP-not-working-tp20617p20627.html
>     <http://vtiger-crm.2324883.n4.nabble.com/SMTP-not-working-tp20617p20627.html>
>     Sent from the vtigercrm-developers mailing list archive at Nabble.com.
>
>     _______________________________________________
>     http://www.vtiger.com/
>
>
>
>
> _______________________________________________
> http://www.vtiger.com/
>


_______________________________________________
http://www.vtiger.com/
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: SMTP not working

Holbok István
In reply to this post by Christophe Humbert

Iko,

You will find the answers at the link of PHP Mailer troubleshooting on GitHub:

https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting

Even the DNS issue is listed there. Also you will find the proper port settings examples, both of tls and ssl.
The vtiger requires SMTP host in the format: ssl://smtp.example.com:465 or tls://smt.example.com:587 and the PHP Mailer will it parse properly.

The DNS issue can be tested by the https://mxtoolbox.com/

And this is the very important part of the troubleshooting guide from the GitHub

If you check all circumstances and it's still not working!

If any of the above checks fail, PHPMailer will not work either, and usually there's nothing that PHPMailer can do about it. So go fix your network, then try again. If you are not in control of your own firewall or DNS, you probably need to raise a support ticket with your ISP to fix this (it's very common for them to block or divert port 25 outbound). If they won't fix it, you need to replace your ISP. PS: BlueHost doesn't support smtp.gmail.com, they want you to use their smtp server. The work around would be to use email associated with BlueHost and their host address Or send using mail() function in this case.

Note: because of these reasons I had just moved one of my clients from GoDaddy to a virtual private server hosted at InMotion Hosting.

Kindest regards:
Istvan

2017.04.07. 10:03 keltezéssel, Christophe Humbert írta:
Hello

You have a DNS issue No route to host

Kind Regards
Chris


On Fri, Apr 7, 2017 at 9:26 AM, iko <[hidden email]> wrote:
Thank you, Istvan for your help. I had right files and UTF-8 was in place.
But no luck getting smtp to work...

Here is what I get in debug message:

2017-04-07 07:30:32 Invalid address: (addAnAddress Reply-To): <a moz-do-not-send="true" href="tel:2017-04-07" value="+35220170407">2017-04-07
07:30:32 Connection: opening to smtp.office365.com:25, timeout=300,
options=array ( ) 2017-04-07 07:30:32 Connection failed. Error #2:
stream_socket_client(): unable to connect to smtp.office365.com:25 (No route
to host) [/removed/modules/Emails/class.smtp.php line <a moz-do-not-send="true" href="tel:294%5D%202017-04-07" value="+35229420170407">294] 2017-04-07
07:30:32 SMTP ERROR: Failed to connect to server: No route to host (65)
2017-04-07 07:30:32 SMTP connect() failed.
https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting

And port should be 587. It is correct in vtiger_systems and I tested with
putting it manually in class.phpmailer.php. But debug message remains the
same with port 25.

Regarding the smtp.phps code. Where should I insert it? I'm sorry for my
being inexperienced.



--
View this message in context: http://vtiger-crm.2324883.n4.nabble.com/SMTP-not-working-tp20617p20627.html
Sent from the vtigercrm-developers mailing list archive at Nabble.com.

_______________________________________________
http://www.vtiger.com/



_______________________________________________
http://www.vtiger.com/



_______________________________________________
http://www.vtiger.com/
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: SMTP not working

Holbok István
In reply to this post by its4you

Yes, of course ...


2017.04.07. 10:19 keltezéssel, IT-Solutions4You írta:
Hi all,

maybe you should consider updating the same files under cron directory too ;)


Matus

Dňa 7. 4. 2017 o 10:03 Christophe Humbert napísal(a):
Hello

You have a DNS issue *No route to host*

Kind Regards
Chris


On Fri, Apr 7, 2017 at 9:26 AM, iko
<[hidden email]
[hidden email]> wrote:

    Thank you, Istvan for your help. I had right files and UTF-8 was in
    place.
    But no luck getting smtp to work...

    Here is what I get in debug message:

    2017-04-07 07:30:32 Invalid address: (addAnAddress Reply-To):
    2017-04-07 <a class="moz-txt-link-rfc2396E" href="tel:2017-04-07"><tel:2017-04-07>
    07:30:32 Connection: opening to smtp.office365.com:25
    <http://smtp.office365.com:25>, timeout=300,
    options=array ( ) 2017-04-07 07:30:32 Connection failed. Error #2:
    stream_socket_client(): unable to connect to smtp.office365.com:25
    <http://smtp.office365.com:25> (No route
    to host) [/removed/modules/Emails/class.smtp.php line 294]
    2017-04-07 <a class="moz-txt-link-rfc2396E" href="tel:294%5D%202017-04-07"><tel:294%5D%202017-04-07>
    07:30:32 SMTP ERROR: Failed to connect to server: No route to host (65)
    2017-04-07 07:30:32 SMTP connect() failed.
    https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting
    <https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting>

    And port should be 587. It is correct in vtiger_systems and I tested
    with
    putting it manually in class.phpmailer.php. But debug message
    remains the
    same with port 25.

    Regarding the smtp.phps code. Where should I insert it? I'm sorry for my
    being inexperienced.



    --
    View this message in context:
    http://vtiger-crm.2324883.n4.nabble.com/SMTP-not-working-tp20617p20627.html
    <http://vtiger-crm.2324883.n4.nabble.com/SMTP-not-working-tp20617p20627.html>
    Sent from the vtigercrm-developers mailing list archive at Nabble.com.

    _______________________________________________
    http://www.vtiger.com/




_______________________________________________
http://www.vtiger.com/



_______________________________________________
http://www.vtiger.com/



_______________________________________________
http://www.vtiger.com/
iko
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: SMTP not working

iko
In reply to this post by Holbok István
Success! Thank you Istvan, for reminding me of tls://smtp.office365.com:587. I set it in server name in vtiger_systems and it worked!

Setting smtp settings via frontend makes system to hang. But it worked fine through database.

This increased my Spam score to 8 of 10! With phpmailer it was -1,5 :)

Spam checker gives me minus on following:

-0.635 HTML_MIME_NO_HTML_TAG HTML-only message, but there is no HTML tag
Din melding bør inneholde en <html>-tag
-1.105 MIME_HTML_ONLY Message only has text/html MIME parts

I wonder if this can be fixed?  There is <html> tag in the email if you see the source in Vtiger. And I tried to insert text outside html tags. But no success in making spam checker happier.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: SMTP not working

Preexo
In reply to this post by iko
It doesn't look like a code problem, more like a configuration problem. Your host set correctly? And port 25 is correct? You sure these settings ever worked before?

On April 7, 2017 3:26:56 PM GMT+08:00, iko <[hidden email]> wrote:
Thank you, Istvan for your help. I had right files and UTF-8 was in place.
But no luck getting smtp to work...

Here is what I get in debug message:

2017-04-07 07:30:32 Invalid address: (addAnAddress Reply-To): 2017-04-07
07:30:32 Connection: opening to <a href="smtp.office365.com:25">smtp.office365.com:25, timeout=300,
options=array ( ) 2017-04-07 07:30:32 Connection failed. Error #2:
stream_socket_client(): unable to connect to <a href="smtp.office365.com:25">smtp.office365.com:25 (No route
to host) [/removed/modules/Emails/class.smtp.php line 294] 2017-04-07
07:30:32 SMTP ERROR: Failed to connect to server: No route to host (65)
2017-04-07 07:30:32 SMTP connect() failed.
https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting

And port should be 587. It is correct in vtiger_systems and I tested with
putting it manually in class.phpmailer.php. But debug message remains the
same with port 25.

Regarding the smtp.phps code. Where should I insert it? I'm sorry for my
being inexperienced.



--
View this message in context: http://vtiger-crm.2324883.n4.nabble.com/SMTP-not-working-tp20617p20627.html
Sent from the vtigercrm-developers mailing list archive at Nabble.com.



http://www.vtiger.com/

--
Diese Nachricht wurde von meinem Android-Mobiltelefon mit K-9 Mail gesendet.
_______________________________________________
http://www.vtiger.com/
iko
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: SMTP not working

iko
If you save smtp settings via frontend server name is saved as smtp.office365.com port 25 etc.
At some point it worked. Then it stopped working and I changed to sendmail.
But now, apparently, I had to manually set tls://...:587 in vtiger_systems. Weird. But I am so relieved this issue is fixed now.

Since the spam score is so good now, I may begin to send campaign emails with Vtiger directly. And skip MailChimp sync.

Anyone who used Vtiger for mass mailing? are there any limits? cron needed?
iko
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: SMTP not working

iko
Just an update on my questions about making spam score better. Here is the fix http://code.vtiger.com/vtiger/vtigercrm/issues/114

iko
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: SMTP not working

iko
Another update :) After applying the patch I got 10/10 on spam test with https://www.mail-tester.com!
Loading...