Linode Forum
https://forum.linode.com/

Email sender marked as 'on behalf of'
https://forum.linode.com/viewtopic.php?f=11&t=3224
Page 1 of 1

Author:  mike_eci [ Mon Apr 21, 2008 1:28 pm ]
Post subject:  Email sender marked as 'on behalf of'

I've created a php application on linode that sends out emails - the received emails are shown as being sent from '[user]@mydomain.net on behalf of [email]@mydomain.net' where [user] is the user php-cgi is running under, and [email] is what I want to have as the sender.

The email only appears in certain clients like this (e.g outlook).

distro is centos 5.

hostname is set to mydomain.net in /etc/sysconfig/network.
In the linode control panel 'dashboard->utilities->reverse dns manager' I've set : my.ip.addr.ress to mydomain.net
I've restarted networking.

I'm stuck now as what to try next.. I've never had this issue on other vps I've used, probably something very simple I'm missing..

Author:  chrisnolan [ Mon Apr 21, 2008 2:23 pm ]
Post subject: 

How are you sending mail through php? I presume you're using the default mail() function so what settings do you have in php.ini for "SMTP", "sendmail_from", and "sendmail_path"? If you're sending using sendmail have you tried using the "-t" argument to sendmail? This forces the from address.

Author:  mike_eci [ Mon Apr 21, 2008 3:13 pm ]
Post subject: 

I'm using the swiftmailer library with it's 'native mail' sending option. Swiftmailer does a good job of making sure all headers and fields are correctly defined, so I'm fairly sure the headers are being rewritten post-php. I've been using the same code on other centos vps providers without any issue, so don't know if it's a quirk that may be specific to linode.

Author:  marv [ Mon Apr 21, 2008 3:25 pm ]
Post subject: 

I'm not familiar with swiftmailer or how to configure it, but I think this has to do with the email headers. Outlook displays the "on behalf of" if there is a "Sender" header in the email.

So most likely, your headers are something like this:
Code:
From: "John Doe" <[user]@mydomain.net>
Sender: [email]@mydomain.net
To: some-email@somehost.com

If you can get swiftmailer to not send the "Sender" header, then Outlook won't display the "on behalf of."

Author:  mwalling [ Tue Apr 22, 2008 7:43 am ]
Post subject: 

Doesn't lookOut mark a message "On Behalf Of" when the From: header doesn't equal the envelope from?

Author:  sweh [ Tue Apr 22, 2008 1:07 pm ]
Post subject: 

OutHouse doesn't get to see the envelope of the message; that's handled by the MTA and not the MUA.

Author:  mwalling [ Tue Apr 22, 2008 1:38 pm ]
Post subject: 

Code:
Microsoft Mail Internet Headers Version 2.0
Received: from WorkSMTP ([0.0.0.0]) by WorkSMTP with Microsoft SMTPSVC(6.0.3790.2499);
    Mon, 3 Dec 2007 15:49:02 -0500
Received: from WorkSMTP ([0.0.0.0]) by WorkSMTP with Microsoft SMTPSVC(6.0.3790.2499);
    Mon, 3 Dec 2007 15:49:01 -0500
Received: from WorkSMTP (WorkSMTP [0.0.0.0])
   by WorkSMTP (8.13.6/8.13.6/20050510-SVVS) with ESMTP id lB3Kn19r026576
   for <markw.walling@work>; Mon, 3 Dec 2007 15:49:01 -0500
Received: from www.theshore.net (ns.theshore.net [67.18.92.50])
   by WorkSMTP (8.13.6/8.13.6/20051114-SVVS-TLS-DNSBL) with ESMTP id lB3KmCjc012831
   for <markw.walling@work>; Mon, 3 Dec 2007 15:48:59 -0500
Received: from localhost (localhost [127.0.0.1])
   by www.theshore.net (8.13.6/8.9.1) with ESMTP id lB3Klluq027848;
   Mon, 3 Dec 2007 15:47:47 -0500
Message-Id: <200712032047.lB3Klluq027848@www.theshore.net>
Content-type: text/plain
Date: Mon, 03 Dec 2007 15:47:34 -0500
From: service@linode.com
Subject: Linode Account Activation
To: markw.walling@work
Return-Path: service@linode.com
X-OriginalArrivalTime: 03 Dec 2007 20:49:01.0702 (UTC) FILETIME=[EF383A60:01C835ED]


Quoting RFC 2821, section 4.4:

Quote:
When the delivery SMTP server makes the "final delivery" of a
message, it inserts a return-path line at the beginning of the mail
data. This use of return-path is required; mail systems MUST support
it. The return-path line preserves the information in the <reverse-
path> from the MAIL command. Here, final delivery means the message
has left the SMTP environment. Normally, this would mean it had been
delivered to the destination user or an associated mail drop, but in
some cases it may be further processed and transmitted by another
mail system.


So, no, it doesn't see the actual envelope, but it sees the envelope data as added to the message by the MTA.

Author:  mike_eci [ Wed Apr 23, 2008 8:37 am ]
Post subject: 

I seem to have sorted this -

I added the user php is running under to the exim.conf file:

trusted_users = mail:apache:my-php-cgi-user

It would appear that exim by default rewrites the headers if it doesn't 'trust' the user the sending application is running under. Normally I'd be running php under user apache but int his instance I have 2 seperate php installs for v4 & v5 with the cgi version running under another user.

Page 1 of 1 All times are UTC-04:00
Powered by phpBB® Forum Software © phpBB Group
http://www.phpbb.com/