Skip to content

Conversation

@puggan
Copy link

@puggan puggan commented Oct 30, 2013

if the from-header looks like
"FROM: user@domain.net"
the return-path becomes
"Return-path: <"FROM:user"@domain.net>"

while
"From: user@domain.net"
and
"FROM: user@domain.net"
makes
"Return-path: user@domain.net"

@ajwans
Copy link
Owner

ajwans commented Nov 6, 2013

Is this available on all platforms? If not does it need a configure check?

@puggan
Copy link
Author

puggan commented Nov 6, 2013

Sorry for not saying somthing about the config file,
i guess its the "FromLineOverride=YES"

the other 2 options dosn't look relevant

cat /etc/ssmtp/ssmtp.conf | grep -v -P "^(#|$)"
root=postmaster
mailhub=faceways.se
FromLineOverride=YES

@puggan
Copy link
Author

puggan commented Nov 6, 2013

In gentoo, with the config file above, if i run:
echo -e "FROM: puggan@faceways.se\nTO: puggan@faceways.se\nSUBJECT: Test ssmtp\n\ntest ssmtp" | sendmail -t

the mail header end up as "Return-Path: <"FROM:puggan"@faceways.se>"

I see no reason for other platforms to have other results

@xenlo
Copy link

xenlo commented Aug 23, 2017

Observed the same behavior on an Debian 7.11 (wheezy) with ssmtp version: 2.64-7.
In function of the "From:" format put in the header used with the PHP mail() function we get the following answers from other mail servers:

status=bounced (host gmail-smtp-in.l.google.com[…] said: 553-5.1.2 The sender address FROM:sender@mydomain.com is not a valid RFC-5321 553 5.1.2 address. gsmtp (in reply to MAIL FROM command))

Here are several header combination that I tested:

<?php
     $to      = 'mail@example.com';
     $subject = 'The Subject';
     $message = 'Content';
//    $headers  = "From: <sender@mydomain.com>\r\n";                  // Works
//    $headers  = "From: \"sender@mydomain.com\"\r\n";                // Works
//    $headers  = "FROM: <sender@mydomain.com>\r\n";                  // Works
//    $headers  = "From: sender@mydomain.com\r\n";                    // Works
//    $headers  = "FROM: sender@mydomain.com\r\n";                    // Fails
    $headers  = "FROM:sender@mydomain.com\r\n";                       // Fails
     $headers .= "MIME-Version: 1.0\r\n";
     $headers .= "Content-type: text/txt; charset=iso-8859-1\r\n";
     mail($to, $subject, $message, $headers);
 ?>

@xenlo
Copy link

xenlo commented Aug 23, 2017

Please note that, according the the RFC 5322 section 3.6.2 FROM: sender@mydomain.com don't really follow the recommendation, nevertheless it is not incorrect neither (still following the same RFC section 1.2.2).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants