Failed sending mail[SOLVED]

Alates Tundmatu
Liige alates
[21-Jan-2016 18:32:28 America/New_York] Warning: Failed sending e-mail to someone@cwebsite.com: SMTP connect() failed. in ~/vqmod/vqcache/vq2-includes_functions_func_email.inc.php (Line 62)

Apparently the "Order Copy Recipients" emails aren't working, because both of those email errors were the same email address I entered into Settings>Checkout>Order Copy Recipients. I deleted the email that was previously entered here to see if that was the problem and the error log no longer had two email errors, but just one.

tim
Founder
Alates Sweden
Liige alates
tim

This topic was split form another thread. I seem to have lost your configuration example. If you are using GMail. Please make sure GMail supports this feature. I have heard GMail does not only allow SMTP delivery to external addresses.

Alates Tundmatu
Liige alates

I was using gmail, but just for testing, and I will check to see what the configurations should be for that, but more of a concern to me is that I'm not able to send emails to customers after their purchase. It seems that when a customer completes a purchase the system is trying to send a copy of the invoice to the customer, and is unable too, regardless of if they are using gmail or not. I had a customer purchase something using an aol address for their customer account and it too shows up in the error log as the same error:

[24-Jan-2016 17:28:59 America/New_York] Warning: Failed sending e-mail to person@aol.com: SMTP connect() failed. in ~/vqmod/vqcache/vq2-includes_functions_func_email.inc.php (Line 62)
tim
Founder
Alates Sweden
Liige alates
tim

What are your SMTP settings?

Alates Tundmatu
Liige alates

Line 24 to 36 in Vq2-includes_functions_fun_email.inc.php

$phpmailer->isSMTP();
    $phpmailer->Host = 'smtp.gmail.com';
    $phpmailer->Port = 587; // Set 587 for GMail
    $phpmailer->SMTPSecure = 'tls'; // Set tls for GMail

    $phpmailer->SMTPAuth = true;
    $phpmailer->Username = 'username@gmail.com';
    $phpmailer->Password = 'password';

    $phpmailer->CharSet = language::$selected['charset'];
    $phpmailer->Encoding = 'quoted-printable';
    $phpmailer->setFrom($from_email, $from_name);
    $phpmailer->Subject = $subject;
tim
Founder
Alates Sweden
Liige alates
tim

Try enabling $phpmailer->SMTPDebug, I read that if omitted it can produce errors. You can also search the web how to debug the phpmailer component.

$phpmailer->SMTPDebug  = 2;        // enables SMTP debug information (for testing)
                                   // 1 = errors and messages
                                   // 2 = messages only

I also found this:

http://phpmailer.worxware.com/?pg=examplebgmail

Alates Tundmatu
Liige alates

I set SMTPDebug = 2 and it produced this error:

[26-Jan-2016 11:43:50 America/New_York] Warning: Blocked a potential CSRF hacking attempt by [ip address] [Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/47.0.2526.106 Safari/537.36] requesting /en/ajax/get_address.json?trigger=lastname.
[26-Jan-2016 11:44:54 America/New_York] Warning: Blocked a potential CSRF hacking attempt by [ip address] [Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/47.0.2526.106 Safari/537.36] requesting /en/ajax/get_address.json?trigger=lastname.
[26-Jan-2016 11:44:56 America/New_York] Warning: Blocked a potential CSRF hacking attempt by [ip address] [Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/47.0.2526.106 Safari/537.36] requesting /en/ajax/get_address.json?trigger=password.
[26-Jan-2016 11:45:00 America/New_York] Warning: Blocked a potential CSRF hacking attempt by [ip address] [Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/47.0.2526.106 Safari/537.36] requesting /en/create_account.
[26-Jan-2016 11:45:00 America/New_York] Warning: Blocked a potential CSRF hacking attempt by [ip address] [Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/47.0.2526.106 Safari/537.36] requesting /en/ajax/get_address.json?trigger=confirmed_password.
[26-Jan-2016 11:50:07 America/New_York] Warning: Failed sending e-mail to user@gmail.com: SMTP connect() failed. in ~/vqmod/vqcache/vq2-includes_functions_func_email.inc.php (Line 62) /en/create_account

I disabled HTTP Post protection and this error stopped occurring. Now I'm just receiving a generic error:

[26-Jan-2016 12:46:18 America/New_York] Warning: Failed sending e-mail to user@gmail.com: SMTP connect() failed. in ~/vqmod/vqcache/vq2-includes_functions_func_email.inc.php (Line 62)
Alates Tundmatu
Liige alates

I switched from SMTP server with Google to using Sendmail by changing 

$phpmailer->isSMTP();

to

$phpmailer->IsSendmail();

Worked right away.

tim
Founder
Alates Sweden
Liige alates
tim

Thank you for sharing your solution on Gmail. Glad you are up and running.

Alates Tundmatu
Liige alates

Thanks for your help and attention!

Kustutatud
Alates Tundmatu

Hello,

I had the "same" issue with PHPMailer not working with the following settings:

$phpmailer->isSMTP();
    $phpmailer->Host = 'xxx.xxx.com';
    $phpmailer->Port = 465; // Set 587 for GMail
    $phpmailer->SMTPSecure = 'tls'; // Set tls for GMail

    $phpmailer->SMTPAuth = true;
    $phpmailer->Username = 'xxx@xxx.se';
    $phpmailer->Password = 'password';

    $phpmailer->CharSet = language::$selected['charset'];
    $phpmailer->Encoding = 'quoted-printable';
    $phpmailer->setFrom($from_email, $from_name);
    $phpmailer->Subject = $subject;

 
error.log gave me:

[14-Mar-2016 21:09:10 Europe/Stockholm] PHP Fatal error:  require_once(): Failed opening required '1' (include_path='.:/opt/alt/php56/usr/share/pear:/opt/alt/php56/usr/share/php') in /home/xxx/public_html/includes/functions/func_email.inc.php on line 2
[14-Mar-2016 21:24:01 Europe/Stockholm] Warning: Failed sending e-mail to xxxx@xxx.com: SMTP connect() failed. in ~/vqmod/vqcache/vq2-includes_functions_func_email.inc.php (Line 61)

Replacing:

$phpmailer->isSMTP();

With:

$phpmailer->IsSendmail();

worked for me as well! Thanks Trevor for sharing your solution!

Kustutatud
Alates Tundmatu

[color=#333333]Replacing:[/color]

$phpmailer->isSMTP();

[color=#333333]With:[/color]

$phpmailer->IsSendmail();

solved my problem too

Teie
This website uses no cookies and no third party tracking technology. We think we can do better than others and really think about your privacy.