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 4 of 4

Thread: email help?

  1. #1
    New Coder
    Join Date
    Apr 2003
    Posts
    10
    Thanks
    0
    Thanked 0 Times in 0 Posts

    email help?

    hi, im new to php, and i want to write a simple email program:

    <html>
    <body>
    <?
    $to = "lemmiwinksx@lemmiwinksx.com";
    $subject = "php is cool";
    $body = "hello dylan";
    $from = "cowsin@aol.com";
    mail($to,$subject,$body,$from);
    echo "mail was send to $to";
    ?>



    </body>
    </html>


    it sends the mail, but it says from "webmaster@lemmiwinksx.com" instead of cowsin@aol.com
    cowsin@aol.com comes as a link in the body, just above the mesage. is it supposed to do that?


    thank you so much,
    dylan

  • #2
    New Coder
    Join Date
    Apr 2003
    Posts
    10
    Thanks
    0
    Thanked 0 Times in 0 Posts
    opps i forgot to include the From:
    thanks for looking

  • #3
    Regular Coder
    Join Date
    Jun 2002
    Location
    Depends on the time of year
    Posts
    478
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Prior Post..


  • #4
    Senior Coder missing-score's Avatar
    Join Date
    Jan 2003
    Location
    UK
    Posts
    2,194
    Thanks
    0
    Thanked 0 Times in 0 Posts
    PHP Code:
    <?
    $to 
    "lemmiwinksx@lemmiwinksx.com";
    $subject "php is cool";
    $body "hello dylan";
    $from "cowsin@aol.com\\n"// The main problem is that you do not have  a \\n here.

    // Also:
    if(mail($to,$subject,$body,$from))
    {
       echo 
    "mail was send to $to";
    }
    else
    {
       echo 
    "mail was not sent this time";
    }
    // By putting this in an if statement gives you a more accurate reading of what has happened.
    ?>


  •  

    Posting Permissions

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