Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 8 of 8
  1. #1
    New Coder
    Join Date
    Feb 2007
    Posts
    35
    Thanks
    0
    Thanked 0 Times in 0 Posts

    php email withouth From: in the headers

    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???

  • #2
    Regular Coder meth's Avatar
    Join Date
    Jan 2003
    Posts
    262
    Thanks
    0
    Thanked 9 Times in 9 Posts
    Why would you want to do that? Not stating a reason makes your intention sound suspicious.
    I do Web Design, Brisbane based.
    More time spent in PHP/MySQL Web Development.
    And Search Engine Optimisation takes up the rest of it.

  • #3
    New Coder
    Join Date
    Feb 2007
    Posts
    35
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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.

  • #4
    Mega-ultimate member
    Join Date
    Jun 2002
    Location
    Winona, MN - The land of 10,000 lakes
    Posts
    1,855
    Thanks
    1
    Thanked 45 Times in 42 Posts
    Quote Originally Posted by meth View Post
    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....

    Code:
    $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.

  • #5
    Regular Coder meth's Avatar
    Join Date
    Jan 2003
    Posts
    262
    Thanks
    0
    Thanked 9 Times in 9 Posts
    If I understood the question right, he wants to send without a From: header. Spam? It'll default to the php directive but...
    I do Web Design, Brisbane based.
    More time spent in PHP/MySQL Web Development.
    And Search Engine Optimisation takes up the rest of it.

  • #6
    Senior Coder
    Join Date
    Jan 2007
    Posts
    1,648
    Thanks
    1
    Thanked 58 Times in 54 Posts
    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.

  • #7
    New Coder
    Join Date
    Feb 2007
    Posts
    35
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by meth View Post
    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.

  • #8
    New Coder
    Join Date
    Feb 2007
    Posts
    35
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by bcarl314 View Post
    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....

    Code:
    $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?


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •