• Welcome to the Chevereto user community!

    Here users from all over the world gather around to learn the latest about Chevereto and contribute with ideas to improve the software.

    Please keep in mind:

    • 😌 This community is user driven. Be polite with other users.
    • 👉 Is required to purchase a Chevereto license to participate in this community (doesn't apply to Pre-sales).
    • 💸 Purchase a Pro Subscription to get access to active software support and faster ticket response times.

phpmail duplicate header

Status
Not open for further replies.

StZ

Chevereto Member
Creo que alguna vez existio una seccion en espanol pero bueno... aplicaremos ingles chilensis


A possible bug, when i try to use the phpmail function to send the emails with chevereto i got this error from amazon ses relay:

R=send_via_ses T=ses_smtp X=TLSv1:AES256-SHA:256: SMTP error from remote mail server after end of data: host ses-smtp-prod-335357831.us-east-1.elb.amazonaws.com [23.21.91.54]: 554 Transaction failed: Duplicate header 'Subject'

My server is configured to send all the emails using ses based in this how to from amazon:
docs.aws.amazon.com/ses/latest/DeveloperGuide/exim.html

But if i use the smtp auth function of chevereto the email was send without problems.

Please can you check this,

Thanks

Regards
 
This one...

pBxA.png


Here is the full header of the email, you can see there the subject two times in the email header:


Return-path: <xxxx@xxxx.xx>
Received: from [10.0.200.1] (helo=xxx.xx)
by xxxx.xx with esmtp (Exim 4.84 (FreeBSD))
(envelope-from <xxxx@xxxx.xx>)
id 1Y7Wmh-00007c-OP
for xxxx@xxxx.xx; Sat, 03 Jan 2015 19:03:00 -0300
Received: (from xxxx@xxxx.xx)
by xxxx.xx (8.14.9/8.14.9/Submit) id t03M2xa6000471;
Sat, 3 Jan 2015 19:02:59 -0300 (CLST)
(envelope-from xxxx)
To: xxxx@xxxx.xx
Subject: Confirmation required at img Host
X-PHP-Originating-Script: 1001:class.phpmailer.php
Date: Sat, 3 Jan 2015 19:02:59 -0300
From: img Host <xxxx@xxxx.xx>
Subject: Confirmation required at img Host
Message-ID: <xxxx@xxxx.xx>
X-Priority: 3
X-Mailer: PHPMailer 5.2.7 (https://github.com/PHPMailer/PHPMailer/)
MIME-Version: 1.0
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: 8bit
 
And you are using an Amazon webservice with that? Where I can sigup for that thing to test it?
 
Yes the amazon SES service, i use it with all my sites.

If you have a amazon aws account, just select SES in the services tab, you have to validate your domain (using a txt record).

To recreate the problem you don't need to test it with amazon, just change the mail configuration of chevereto to use phpmail() and create a account, when you get the message check the raw source/full email headers and you will see the subject twice in the headers.
 
Chevereto CHV\send_mail is just a wrapper of PHPMailer and I don't see anything duplicated in the code. Check this in app/lib/functions.php

PHP:
function send_mail($to, $subject, $body) {
   
    $own_name = __FUNCTION__ . '()';
   
    $args = ['to', 'subject', 'body'];
   
    foreach(func_get_args() as $k => $v) {
        if(!$v) {
            throw new Exception('Missing $'.$args[$k].' in '. $own_name);
        }
    }
    if(!filter_var($to, FILTER_VALIDATE_EMAIL)) {
        throw new Exception('Invalid email in ' . $own_name);
    }
    foreach(['email_from_email', 'email_from_name'] as $v) {
        if(!getSettings()[$v]) {
            throw new Exception('Invalid $'.$v.' setting in ' . $own_name);
        }
    }
   
    try {
        $mail = new \Mailer();
        $mail->CharSet = 'UTF-8';
        $mail->IsHTML(true);
        $mail->Mailer = getSettings()['email_mode'];
        if(getSettings()['email_mode'] == 'smtp') {
            $mail->IsSMTP();
            $mail->SMTPAuth = true;
            $mail->SMTPSecure = getSettings()['email_smtp_server_security'];
            $mail->Port    = getSettings()['email_smtp_server_port'];
            $mail->Host = getSettings()['email_smtp_server'];
            $mail->Username = getSettings()['email_smtp_server_username'];
            $mail->Password = getSettings()['email_smtp_server_password'];
        }
        $mail->Timeout = 30;
        $mail->Subject = $subject;
        $mail->Body = $body;
        $mail->From = getSettings()['email_from_email'];
        $mail->FromName = getSettings()['email_from_name'];
        $mail->AddAddress($to);
        if($mail->Send()) {
            return true;
        } else {
            throw new Exception($mail->DbgOut, 300);
        }
    } catch (Exception $e) {
        throw new Exception($e->getMessage(), $e->getCode());
    }
   
}

I will check the demo website with that email mode (phpmail()) to see if maybe your server is adding it.
 
My server adding headers??? nahh....the history of my life, always the server problem :( but noup the server its ok :)

But a have another proof of the problem, i made a test with imgup.io (this website is in the showcase subforum) and you can see the duplicate headers: TO and subject.

The duplicate for the destination address (TO) can be fixed changing the value of " public $SingleTo" to true in app/lib/classes/class.phpmailer.php, but i didnt know how to fix the duplicate subject in the headers.

To: xxx@xxx.xxx
Subject: Welcome to Imgup <--

X-PHP-Script: imgup.io/index.php
Date: Mon, 5 Jan 2015 05:33:07 +0000
To:xxx@xxx.xxx
From: ImgUp <no-reply@imgup.io>
Subject: Welcome to Imgup <--
Message-ID: <7d0b7764438c77c340104b65c487d474@imgup.io>
X-Priority: 3
X-Mailer: PHPMailer 5.2.7 (https://github.com/PHPMailer/PHPMailer/)
MIME-Version: 1.0
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: 8bit

And how this look in a email client??

The duplicate TO and Subject:
acDp3.png
 
Last edited:
Did you tried updating phpmailer? I haven't updated it in ages. Like I said, the thing is just a wrapper of phpmailer.
 
PHPMailer has been updated in the latest release. Try seeing if you still get this issue.
 
Status
Not open for further replies.
Back
Top