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 3 of 3
  1. #1
    New Coder
    Join Date
    May 2005
    Posts
    44
    Thanks
    0
    Thanked 0 Times in 0 Posts

    SendMail defaulting to "anonymous"

    Emails are being sent alright except the From address is replaced with: anonymous@cgi1.cgi1
    This is the code I am using. Do I need to instruct the script as to the location of sendmail? Sendmail on the Linux server at my Netfirm.com hosting service is: /usr/lib/sendmail. I have not seen in any other poster's codes where they had to use it. If you can, please show me what I need to do differently.

    PHP Code:
    <?php
    $From 
    "NevadaSam@gmail.com";
    $To "NevadaSam@gmail.com";
    $Subject "Test email";
    $Message "My first email test with php.";
    $Headers "$From: $From";
    $MessageSent mail($To$Subject$Message$Headers);
    if (
    $MessageSent) {
        echo 
    "<p>The following message was sent
            successfully:</p><hr />"
    ;
        echo 
    "<p><strong>From</strong>: $From</p>";
        echo 
    "<p><strong>To</strong>: $To</p>";
        echo 
    "<p><strong>Subject</strong>: $Subject</p>";
        echo 
    "<p><strong>Message</strong>: $Message</p>";
    }
    else
        echo 
    "<p>The message was not sent successfully!</p>";
    ?>

  • #2
    Super Moderator
    Join Date
    May 2002
    Location
    Perth Australia
    Posts
    4,108
    Thanks
    11
    Thanked 101 Times in 99 Posts
    $Headers = "$From: $From";

    should be

    $Headers = "From: $From";

    and depending on your mailserver should have a trailing "\n" or "\r\n"
    resistance is...

    MVC is the current buzz in web application architectures. It comes from event-driven desktop application design and doesn't fit into web application design very well. But luckily nobody really knows what MVC means, so we can call our presentation layer separation mechanism MVC and move on. (Rasmus Lerdorf)

  • #3
    New Coder
    Join Date
    May 2005
    Posts
    44
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Well, that was embarassing The person whom coined the phrase "There are no stupid question.", never meet me. I will try to proofread my scripts better.

    Problem Solved!
    Thanks,
    Samantha


  •  

    Posting Permissions

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