Linode.com Forum Forum Index Linode.com Forum
Linode Community Forums
 


Email sender marked as 'on behalf of'

Click here to go to the original topic

 
       Linode.com Forum Forum Index -> Email/SMTP Related Forum
Author Message
mike_eci



Joined: 21 Apr 2008
Posts: 4
Location: UK

Posted: Mon Apr 21, 2008 12: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..
Back to top  
chrisnolan



Joined: 02 Jun 2006
Posts: 15

Posted: Mon Apr 21, 2008 1: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.
Back to top  
mike_eci



Joined: 21 Apr 2008
Posts: 4
Location: UK

Posted: Mon Apr 21, 2008 2: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.
Back to top  
marv



Joined: 09 Mar 2008
Posts: 9

Posted: Mon Apr 21, 2008 2: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."
Back to top  
mwalling



Joined: 10 Dec 2007
Posts: 127

Posted: Tue Apr 22, 2008 6:43 am    Post subject:  

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



Joined: 13 Apr 2004
Posts: 223

Posted: Tue Apr 22, 2008 12: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.
Back to top  
mwalling



Joined: 10 Dec 2007
Posts: 127

Posted: Tue Apr 22, 2008 12: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.
Back to top  
mike_eci



Joined: 21 Apr 2008
Posts: 4
Location: UK

Posted: Wed Apr 23, 2008 7: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.
Back to top  
 
       Linode.com Forum Forum Index -> Email/SMTP Related Forum
Page 1 of 1