Mailed-by Header

software development

#1

So I know this is set by the outgoing server, for obvious purposes. Here’s my question with some quick info as to why. I have all mail from one of my domains forwarding to one address. Just a lot easier than checking many mailboxes per day. If I need to ever reply, I made a simple php script, using mail(). However, the mailed-by line says the server my account is on (federal.dreamhost.com). Is there anyway to make that say mydomain.com (mydomain.com of course being my actual domain, but I didn’t want to just paste it here)? Just makes the email seem a bit phoney, to me at least, if it wasn’t mailed-by your own domain. Know what I mean?

TIA for all the help.


#2

Try this, replacing you@example.com with the address you want it sent from:

mail($recipient, $subject, $message, $headers, ‘-fyou@example.com’);

Or replace $headers with null, if you’re not adding any headers.


:stuck_out_tongue: Maximum savings promo code: MaxSavingsAtDH


#3

What exactly does the -f option do in mail? I can use a header to make it seem like it was sent by an address. Will the -f option use the SMTP of the email address I provide?? Or…???


#4

There’s more info here: http://us3.php.net/manual/en/function.mail.php.

Here’s a quote from that page:


:stuck_out_tongue: Maximum savings promo code: MaxSavingsAtDH


#5

While I appreciate the help, and please forgive this, I’m still a bit confused. I’m not trying to ask how to make it so the email says it was sent from (for instance) user@mydomain.com. I can already do that with the header. I’m trying to make it so when you look at all of the information, the mailed-by (which shows the server it was mailed from) doesn’t say federal.dreamhost.com, but it says mydomain.com. I could definitely be wrong, but it seems the -f option is to set the sender’s envelope address, which I’ve already done in the header. I’m trying to change the “mailed-by” from federal.dreamhost.com to mydomain.com. If I misinterpretted the -f feature, please let me know.

Edit: What is odd is if I send an email via squirrelmail, I don’t even see the mailed-by in the header. If they don’t include one, there’s got to be a way for me not to include one?


#6

Just an FYI. Our wiki page on the mail() function gives an example that shows you how to set the “from” and “reply to” headers.

si-blog
Max discount on any plan with promocode SCJESSEYTOTAL


#7

Thanks scjessey, but again, that’s not what my question was. sigh


#8

-f will replace the server name with the email address you enter as the return path. Who it’s sent from will still be whatever you enter in the From: field. Easy - give it a try. :wink:

Just make two test scripts, load each one once to send an email, then compare the headers.

<?php mail('recipient email address', 'subject', 'message', null, '-fyou@email.address'); ?> and

<?php mail('recipient email address', 'subject', 'message'); ?>


:stuck_out_tongue: Maximum savings promo code: MaxSavingsAtDH


#9

That’s why I said “Just an FYI.”

si-blog
Max discount on any plan with promocode SCJESSEYTOTAL


#10

I see what you mean. However, that also was not my question. I already set the Return-Path header :P. I believe I sort of already answered my question though. It seems that when mail() is used, it includes the server it was mailed from as the “mailed-by” header (not really a header, just above the subject. not really a header as in not user configureable). For instance, when I use squirrelmail, which uses its own implementation of SMTP, it doesn’t show anything from the mailed-by. gmail shows gmail.com, comcast doesn’t show anything, etc. I believe I simply need to use something else, unless there is some way I can set mail() to use mail.mydomain.com instead of just federal.dreamhost.com.