Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Order mails rejected by Gmail


Psytanium

Recommended Posts

Hi,

Users with gmail address or using gsuite app, are not receiving Order Process emails, I talked with my host provider, he found in the log the following :

20181218 14:39:17.027 core sid="ZN5Bgzz2hZVaG" id="ZN5Bgzz2hZVaGZN5Bgvnt9" ip="132.148.68.109" action="DROP" reason="BAD-SUB" mailfrom="[email protected]" fromdomain="server.domain.com" recipient_list="[email protected]" todomain="gmail.com" subject="Order Process"|

Only Gmail is rejecting the mails.

Any idea ?

I tried to change the subject from Order to Process, and tried to use regular mail and smtp engine.

and in admin/include/classes/email.php i changed to this :

return mail($to, $subject, $this->output, 'From: '.$from.$this->lf.implode($this->lf, $this->headers).$this->lf.implode($this->lf, $xtra_headers));

Also I tried to add a return path in tep_mail function in generals.php to:

$message = new email(array('X-Mailer: osCommerce System Mailer','Return-Path: <' . STORE_OWNER_EMAIL_ADDRESS . '>'));

But all without success

Anyone know what is

reason="BAD-SUB"
Link to comment
Share on other sites

4 hours ago, Dan Cole said:

What does the email header actually look like?

Dan

I added another email address ([email protected]) so i can receive the email and check the header :

Return-Path: <[email protected]>
Delivered-To: [email protected]
Received: from server.domain.com
	by server.domain.com with LMTP id KEwNFUnsGVyjDAAAAm/+cA
	for <[email protected]>; Wed, 19 Dec 2018 08:59:21 +0200
Return-path: <[email protected]>
Envelope-to: [email protected]
Delivery-date: Wed, 19 Dec 2018 08:59:21 +0200
Received: from user by server.domain.com with local (Exim 4.91)
	(envelope-from <[email protected]>)
	id 1gZVpB-0000z5-6b; Wed, 19 Dec 2018 08:59:21 +0200
To: [email protected],[email protected]
Subject: Order Process
X-PHP-Script: www.domain.com/checkout_process.php for 178.135.82.78
X-PHP-Originating-Script: 556:email.php
From: "Wood and Gas" <[email protected]>
MIME-Version: 1.0
X-Mailer: osCommerce System Mailer
Content-Type: multipart/alternative;
	boundary="=_b4318a54836abb9b2900e16846972d19"
Message-Id: <[email protected]>
Date: Wed, 19 Dec 2018 08:59:21 +0200

 

and this the the tep mail function

function tep_mail($to_name, $to_email_address, $email_subject, $email_text, $from_email_name, $from_email_address) {
    if (SEND_EMAILS != 'true') return false;

    // Instantiate a new mail object
    $message = new email(array('X-Mailer: osCommerce System Mailer','Return-Path: <' . STORE_OWNER_EMAIL_ADDRESS . '>'));

    // Build the text version
    $text = strip_tags($email_text);
    if (EMAIL_USE_HTML == 'true') {
      $message->add_html($email_text, $text);
    } else {
      $message->add_text($text);
    }

    // Send message
    $message->build_message();
    $message->send($to_name, $to_email_address, $from_email_name, $from_email_address, $email_subject);
  }

 

Link to comment
Share on other sites

I tried to change the tep mail function to this

$message->build_message();
    $message->send($to_name, $to_email_address, $from_email_name, $from_email_address, $email_subject,'Return-Path: <' . $from_email_address . '>');

Still the return path didn't change and emails not received

Link to comment
Share on other sites

I'm not going to be around most of today or probably tomorrow so maybe someone else will jump in.  I do wonder however if can you get your hands on the header from one of the emails that is being rejected rather then your test email so you can compare the two and we're looking at one of the actual emails being rejected.  I'm wondering if they are the same?   I would also expect to see  'X-Mailer: osCommerce System Mailer' in the header but it is not so I don't think your using the usual email routine.  That would also explain why your not able to change the return path.

Dan

Link to comment
Share on other sites

6 minutes ago, Psytanium said:

i think the problem is Return-Path, any idea why I can't set Return-Path from tep_mail function ? 

Are you sure you're using that function?  Can you redefine the subject and see if you can change it?

Dan

Link to comment
Share on other sites

To make sure im using the fucntion tep_mail, I changed the subject to test like this :

$message->send($to_name, $to_email_address, $from_email_name, $from_email_address, 'test','Return-Path: [email protected]');

I received email with subject 'Test' but still the Return-Path is  Return-Path: <[email protected]>

it seems I can't overwrite the Return-Path for some reason, most probably this is why Gmail reject my emails.

Link to comment
Share on other sites

It could be that it is defined by your host.   I know when I had issues it was because neither the host or osC was setting it.  I set it and bingo -- my emails started to get through.

Maybe you want to see what your hosts support has to say and whether it can be changed to suit your needs.

Dan

Link to comment
Share on other sites

Only inspected the class function 'send' (admin/includes/classes/email.php).
Your problem exists in the following code:
 

      if (is_string($headers)) {
        $headers = explode($this->lf, trim($headers));
      }

      for ($i=0; $i<count($headers); $i++) {
        if (is_array($headers[$i])) {
          for ($j=0; $j<count($headers[$i]); $j++) {
            if ($headers[$i][$j] != '') {
              $xtra_headers[] = $headers[$i][$j];
            }
          }
        }

        if ($headers[$i] != '') {
          $xtra_headers[] = $headers[$i];
        }
      }

      if (!isset($xtra_headers)) {
        $xtra_headers = array();
      }

      $headers = array_merge($this->headers, array('From: ' . $from), $headers, $xtra_headers);


 completely untested:
 

      if (is_string($headers)) {
        $headers = explode($this->lf, trim($headers));
		print_r($headers);
		die();//stop processing the script
      }

My gut is saying:
 

'Return-Path: [email protected]'

does not or cannot work for the reason it is not recognized as an array.
So i just assume something like:
 

	$myReturnPath = array('Return-path' => '[email protected]');

But i am not 100% sure (even that i am aware i should).
I am not an email expert. 

Link to comment
Share on other sites

Perhaps leave it as you have now and check in the admin:
https://yourdomain.com/admin/configuration.php?gID=12&cID=148
Do you have set that email-option as LF or CRLF ?
If you set it as CLRF switch to LF and try again.
As your "Return-Path" inside the send method is processed as a string.

Be aware, it is only suggestive resource checking.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...