Page 1 of 1

Dummy Mail() headers

Posted: Fri Jun 04, 2004 5:54 pm
by m_m
Im using the PHP mail() fn to send txt msgs. A txt msg is nothing more than an email to a cell phone. No big deal. Problem is, when the cell phone recieves the msg, the actual server address is used as the reply address. Its the first thing displayed on the cell phone. I tried changing all of the headers by including them in the mail() line, but it still doesnt work.

How do I get it to say whatever return address i like?
Do i have to change something in php.ini or does my hosting provider have to turn something on.off??

thanks

Posted: Fri Jun 04, 2004 9:45 pm
by evilmonkey
I'm not exactly sure what you meant by "tried changing the headers", but try this code:

Code: Select all

<?php
mail ("yourcellphone@someaddr.com", "My Subject", "This is just a test message", 
"FROM EvilMonkey\r\n".
"REPLY-TO: evilmonkey@{$_SERVER[SERVER_NAME]}");
?>
Might just waork. Taken straight from the PHP manual. http://ca2.php.net/manual/en/function.mail.php

Good luck!

Posted: Sat Jun 05, 2004 8:16 am
by m_m
Sorry, thats what i ment. Changing Reply-To: as you did will work when in the email, but i need to change the return-path. Im sending txt msgs. it doesnt display the from or reply to addreess, but the return path for some odd reason. What is to be displayed is set in php.ini, but my host doesnt seem to want to help (godaddy). I tried overwriting the send_from setting in the .ini wih ini_set() and even creating an .htaccess file, but neither work.

I cant figure out why. Any ideas?

Posted: Sat Jun 05, 2004 9:21 am
by feyd
Last I saw, the case and syntax of the headers was extremely important:

Code: Select all

mail(
"to_whoever@some_domain.com",
"subject line",
"message",
"From: from_me@mydomain.com\r\n".
"Reply-To: from_someone@elses_domain.com\r\n". // it may be Reply-to, but all the email I quickly checked was 'T'
"Return-Path: yet_another@address.com\r\n" // again, could be Return-path, I couldn't find an example in my email though..
);

Posted: Sat Jun 05, 2004 10:13 am
by hypercooljake
feyd wrote:Last I saw, the case and syntax of the headers was extremely important:

Code: Select all

mail(
"to_whoever@some_domain.com",
"subject line",
"message",
"From: from_me@mydomain.com\r\n".
"Reply-To: from_someone@elses_domain.com\r\n". // it may be Reply-to, but all the email I quickly checked was 'T'
"Return-Path: yet_another@address.com\r\n" // again, could be Return-path, I couldn't find an example in my email though..
);
It is Reply-To: and Return-Path:, not to or path.

Posted: Sat Jun 05, 2004 11:30 am
by m_m
Yeah, I had Return-Path: exactly as you did. Apparently, you can NOT change return-path in the headers, just reply-to. I know the var i have to change is send_from in php.ini, but it doesnt work. I cant figure out why

Posted: Sat Jun 05, 2004 2:56 pm
by launchcode
There is the additional problem of the fact that even if you did manage to hide/mangle this value - there are a significant number or mail servers out there that wouldn't even accept the mail for delivery because of the malformed headers, let alone try to send it.

Posted: Sat Jun 05, 2004 5:08 pm
by m_m
Listen, I know it can be changed. My Question is, is there any reason i would not be able to change the send_from value in the ini file with ini_set()? I figured if it didnt work in .htaccess files it was because they were not allowed.

Posted: Sat Jun 05, 2004 9:16 pm
by launchcode
Because there is no such value? It's sendmail_from, not send_from - and you can set it from anything (script, htaccess, php.ini).

Posted: Sun Jun 06, 2004 12:15 am
by m_m
Ah, sorry thats what i ment. Either way, doesnt work. =/

Posted: Sun Jun 06, 2004 8:35 am
by launchcode
To be honest the name "sendmail_from" implies it might be only related to sendmail.. which not all ISPs use (I know mine doesn't). Just a guess though. m_m - suggest you try asking this on the php.general mailing list.