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 @mydomain.net' where [user] is the user php-cgi is running under, and 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..

7 Replies

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", "sendmailfrom", and "sendmailpath"? If you're sending using sendmail have you tried using the "-t" argument to sendmail? This forces the from address.

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.

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:

`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."[/email]

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

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

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]</markw.walling@work></markw.walling@work>

Quoting RFC 2821, section 4.4:

> 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 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.

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.

Reply

Please enter an answer
Tips:

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct