...

View Full Version : php email withouth From: in the headers



para15000
03-01-2007, 09:36 AM
hello

I know how to send HTML email by midifying the headers with
From: To: and so on and then writing mail("whatever@whatever.com",$subject,$message,$headers); but my problem is that on a server when I do this it says that it can't allow me to send anonymous mail. I'm guessing this is because I use the "From:" attribute in the headers. How can I not use this any more and still be able to send HTML email???

meth
03-01-2007, 12:17 PM
Why would you want to do that? Not stating a reason makes your intention sound suspicious.

para15000
03-01-2007, 01:13 PM
I think it would be suspicious if I wanted to send anonymous mail that is just it I don't want to. My server won't allow me to anyway. Now do you understand? So I am asking how to not send anonymous html mail. I don't understand how this can be suspicious.

bcarl314
03-01-2007, 01:36 PM
Why would you want to do that? Not stating a reason makes your intention sound suspicious.

I disagree. Sending an email with a different from header is very useful and not nefarious in itself. I change the from header on my contact forms so I can see who the email came from in my email client. I change the from header on other scripts for similar reasons - so the reipient know's who it's "from".

One thing you might try...

send your self an email like this...

mail("youremailaddress@yourdomain.com","test","test");

and look at the headers coming through. It will probably say something like "username@domainname.com" in the from, or reply-to header.

Then, modify your code to use a sendmail flag (assuming you're server is using sendmail) like this....



$message = "This is my message";
$subject = "This is my subject";
$headers = "From: from@email.com\nReply-To: from@email.com\n";
$to = "mailto@user.com";
mail($to,$subject,$message,$headers,"-fusername@domainname.com");


the -f flag should resolve your issues.

meth
03-01-2007, 01:44 PM
If I understood the question right, he wants to send without a From: header. Spam? It'll default to the php directive but...

aedrin
03-01-2007, 03:12 PM
when I do this it says that it can't allow me to send anonymous mail.

This is a question for your hosting company or mail software provider.

para15000
03-02-2007, 07:13 AM
If I understood the question right, he wants to send without a From: header. Spam? It'll default to the php directive but...

So you say mail withouth a from: header is spam? why ? I don't understand. I say mail with a From: header is spam because in the From: header you can spoof the other guy's email. I repeat I don't want to do that I want to send HTML mail from my domain with my address not with another address. So I don't want to send spam I want to send legal HTML email like the one this forum sends me when someone answers one of my questions.

para15000
03-02-2007, 07:14 AM
I disagree. Sending an email with a different from header is very useful and not nefarious in itself. I change the from header on my contact forms so I can see who the email came from in my email client. I change the from header on other scripts for similar reasons - so the reipient know's who it's "from".

One thing you might try...

send your self an email like this...

mail("youremailaddress@yourdomain.com","test","test");

and look at the headers coming through. It will probably say something like "username@domainname.com" in the from, or reply-to header.

Then, modify your code to use a sendmail flag (assuming you're server is using sendmail) like this....



$message = "This is my message";
$subject = "This is my subject";
$headers = "From: from@email.com\nReply-To: from@email.com\n";
$to = "mailto@user.com";
mail($to,$subject,$message,$headers,"-fusername@domainname.com");


the -f flag should resolve your issues.

I like this idea but

what does this -f do?



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum