SitePoint Sponsor

User Tag List

Results 1 to 3 of 3

Thread: php and email.

  1. #1
    SitePoint Zealot
    Join Date
    Jul 2000
    Posts
    102
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    i'm using the mail() function to send some simple emails with php. the problem i'm having is i can't get the "from" i specify to show up. instead, the header of the email simply shows the the "from" of the mail server, which is something like webmaster@myhost.com. my test code is below. is there a way to override the "from" field other than what i am doing? thanks!

    <?php

    $mail_to = "whoever@email.com";
    $mail_from = "sender@email.com";
    $mail_subject = "hello.";
    $mail_body = "Here is the message.";


    if(mail($mail_to, $mail_from, $mail_subject, $mail_body))
    echo "Mail sent successfully.";
    else echo "Failed to send the email."

    ?>

  2. #2
    Not Bad, eh? Justin Sampson's Avatar
    Join Date
    Aug 2000
    Location
    N.S., Canada
    Posts
    487
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Try this:

    mail("$mail_to", "$mail_subject", "$mail_body", "From: <$mail_from>");

  3. #3
    SitePoint Zealot
    Join Date
    Jul 2000
    Posts
    102
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    thanks. that kind of flipped things around a bit, but doesn't totally do what i want. i think it will work out ok though for what i need. i think maybe the problem lies possibly in the fact that these emails are being sent to a cell phone. it has a screwy format.

    thanks again.


Bookmarks

Posting Permissions

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