PHP Mail "from"

PHP Mail "from"

Posted by: carlo75
Posted on: 2007-12-20 02:26:00

Hi to all, this is my 1st post in this board. I've a little problem. I need to send an email from a little script, when some thing happens...

The email, work correctly, but when I read that, in the fild "from" there is:

myuserondreamhodt@seltzer.dreamhost.com

But absolutely I don't want that! I want to read my domain name, and not the server where i'm hosted... any idea to fix that directly in php?

Thx in advance for the collaboration

Re: PHP Mail "from"

Posted by: rlparker
Posted on: 2007-12-20 02:42:00

There is information in this previous forum post that might be of help to you. wink

--rlparker

Re: PHP Mail "from"

Posted by: carlo75
Posted on: 2007-12-20 06:39:00

I try to add a line like this

$from = "Da: MySite <admin@site.com>";
$from .= "rn";

but nothing happens :-(((

other clue?

Re: PHP Mail "from"

Posted by: wholly
Posted on: 2007-12-20 06:44:00

As I understand things the "from" is stored in a header using the tag "From:" - despite the use of language. The mail client I believe will display "From:" or "Da:"

You need to put it in the mail headers:

$mailheaders = "From: My website <name@domain.com>";

Don't forget to pass the $mailheaders variable when creating the actual mail. Just putting a value in a string doesn't do anything with it.

Wholly - Use promo code WhollyMindless for discount.

Re: PHP Mail "from"

Posted by: carlo75
Posted on: 2007-12-20 06:47:00

yes got it... I'm italian, and I try to change Da in from, now it works very well...

Thx for the collaboration! to Wholly and rlparker

Re: PHP Mail "from"

Posted by: scjessey
Posted on: 2007-12-20 07:52:00

There is a DreamHost Wiki article about PHP's mail() function that explains how to use headers, etc., by the way.

-- si-blog --

Tags: mail