Mail headers in PHP

Hi, i’m sending email out to members of my site but i’d like the ability to add email addresses stored in a variable into the cc field so that when my members get the email they simply press reply and can email back the address i have stored in these variables.

My header variable is at the bottom of the post, i gather i just need to add a CC part and put the address in there but the actual address for the cc is stored in a var so it will need to be

CC: $variable <$variable>

Does this make sense?

[php]
$headers = ‘From: Me.co.uk [email protected]n’;
[/php]

I know i can do this:

[php]
$headers = “From: [email protected]”;[/php]

But how can i get a variable in the CC bit?

Thanks

first of all: ‘n’ doen’t work. it has to be “n”

and with double quotes u are able tu include variables inside a string.

how about:
[php]$headers = “From: Me.co.uk [email protected]nCc: $variable <$variable>”;[/php]

of cause u may use the string combine operator as well.

[php]$headers = ‘From: Me.co.uk [email protected]’;
$headers .= “n”.‘Cc: ‘.$variable.’ <’.$variable.’>’;[/php]

Actually thinking about it some more, i’m a bit stuck…

The way the system works is this:

Somebody visits my site and makes a request, once i’ve checked this request i send it out to the dealers in my database. At the moment they’re finding it a bit of a pain to copy the original requesters email address from the message and paste it into a new email…

So, i thought that seeing as i grab the requesters email address from the database for the actual message i can simply put it in the CC. The problem with this, is that the dealers will have to click reply to all to give them a reply as well as replying to me…

I thought about putting the requesters email address in the FROM but tat means if any of my dealers email addresses go down then the bounces go to the requester… Is there a way i can set it up so that my dealers get an email with my address and the requesters address so that when they press reply it goes to both of us?

Thanks

for that purpos there is an email header called reply-to.

but i’m not 100% sure whether the reply-to-all button uses the from address if there is a reply-to address as well.

so u have to test whether it’s enough to put just the clients email in an reply-to or whether u have to repeat ur own email as well. never tryed that, nor do i know if it is posible to secify multible reply-to addresses.

but u may search the web for that, now that u know what to search for.

From doing a bit of quick scanning i think it’s possible to do a multiple reply-to, however, for now i think a reply to the requester will be enough…

One thing though, for some reason when i click reply on my test email i’m getting this…

“email.address@” <gmail.com [email protected]>

I’ve used the following code
[php]
$headers = ‘From: TheSparesNetwork.co.uk [email protected]’;
$headers .= “n”.‘Reply-To: ‘.$email.’ <’.$email.’>’;
[/php]

i don’t know much about email header, but as i know the format to secify an address is either
“The Name” [email protected]
or

[email protected]

u may try:
[php]$headers = ‘From: “TheSparesNetwork.co.uk[email protected]’;
$headers .= “n”.‘Reply-To: "’.$email.’" <’.$email.’>’;[/php]

but in this case i would use:
[php]$headers = ‘From: “TheSparesNetwork.co.uk[email protected]’;
$headers .= “n”.'Reply-To: '.$email;[/php]

I used this one and it’s working great. I’ve got one more question…

I’ve been getting emails from the dealers on my database and some of them have been saying that the emails are flagged is spam… Is there anything i can do in terms of the script? Or is just a matter of getting all the dealers on the list to whitelist me?

Thanks

there are a lotta things u can do about this. but i would have to write 20 pages to explain it, cause there are hardly any rules what to do (of cause there can’t be any, otherwise the spammers would do the same).

one very importen (if not the most important) thing is not to send html-email, but multipart or plain text.

u may be able to get about 80-95% passing the spam filters, but to be 100% sure the dealers would have to use a spam-filter-exeption.

I don’t suppose you could recommend any good tutorials or guides on the internet regarding this?

Thanks

i’m afraid, no.
it took me 2 years to learn it.
most was try and error.

Sponsor our Newsletter | Privacy Policy | Terms of Service