SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Addict Philip Toews's Avatar
    Join Date
    Dec 2001
    Location
    Kuala Belait, Brunei
    Posts
    367
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    sendmail path in the mail() function

    In the following pair of scripts, is the sendmail path configured properly? On my web host's server my actual sendmail path is:

    /usr/sbin/sendmail/

    Do I need to specify the path?

    PHP Code:
    <?php
    if (isset($mailnow)){ //if the user wants to mail the page
    $to=$email;
    $subject="$yourname has sent you a web page";
    $message="Dear $name, <br><br>$message<br><br>Take a look at this web page <br><br>$URL<br><br>$yourname";
    $servername="mydomain.com";
    $parameters="From: $yourname\r\n"
        
    ."Reply-To: webmaster@$servername\r\n"
        
    ."sendmail:/usr/sbin/sendmail/";

    mail ($to$subject$message,$parameters );

    }
    ?>

    <?php
    if (isset($mailpage)): //if the user wants to mail the page
    ?>
    <form action="<?=$PHP_SELF?>" method="post">
      <p>Enter your name:<input type="text" name="yourname" size="40"></p><br>
      <p>Enter your friend's name:<input type="text" name="name" size="40"></p><br>
      <p>Enter your friend's e-mail address:<input type="text" name="email" size="40"></p><br>
      <p>Enter a note to send along with the page:<br>
        <textarea cols="40" rows="10" name="message" wrap></textarea>
      </p>

        <input type="hidden" name="URL" value="URL"><br>
        <input type="submit" name="submit_tip" value="mailnow">
      </p>
    </form>

    <?php
    //the link for the user to send mail with
    ?>
    <a href="email.php"?URL=<?=$PHP_SELF?>>Send this page to a friend</a>

    TIA

    p
    Philip Toews Professional esl Educator and ASP.NET wannabe

    http://www.philiptoews.com
    philip@philiptoews.com

  2. #2
    SitePoint Guru
    Join Date
    Aug 2001
    Location
    Amsterdam
    Posts
    788
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    See other thread in PHP it is set in the php.ini the function mail() comes complete
    the neigbours (free) WIFI makes it just a little more fun

  3. #3
    SitePoint Wizard silver trophy redemption's Avatar
    Join Date
    Sep 2001
    Location
    Singapore
    Posts
    5,269
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    let me borrow your thread ok philips??

    i was also making a form mailer from my site and i noticed that even thought i included "Reply-to: email@mymail.com", the received email only included somthing like "email@users.sourceforge.net"...

    my site is hosted on sourceforge so i guess that's why it appended the "@users.sourceforge.net" is there anyway for the actual address to appear??

  4. #4
    SitePoint Addict Philip Toews's Avatar
    Join Date
    Dec 2001
    Location
    Kuala Belait, Brunei
    Posts
    367
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    The URL still doesn's appear in the email

    The form gets sent, but the URL is not included in the message. It is just blank!

    Here is the link that connects to the email form page:

    <a href="email.php?URL=<?$PHP_SELF?>">send this page to a friend </a>

    Any ideas?
    Philip Toews Professional esl Educator and ASP.NET wannabe

    http://www.philiptoews.com
    philip@philiptoews.com

  5. #5
    SitePoint Guru
    Join Date
    Aug 2001
    Location
    Amsterdam
    Posts
    788
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    okay girls and boys ...

    we are gonna take a little field trip

    First stop PHP website

    http://www.php.net/manual/en/function.mail.php

    Here we can see the proper way to work with the mail() function in php..

    As you can see the $parameters (as philip calls them) I prefer $header since it is the mail header.. is optional and can contain header info like from: reply-to: etcetc (read the function at php!!)

    next stop Sitepoint.com articles
    http://www.promotionbase.com/article/571
    http://www.promotionbase.com/article/572

    Here you can see that you can have the "power" of HTML in your email.. (if you really want to)

    Well... I think thats enough travelling for now..

    Greets

    Peanuts
    the neigbours (free) WIFI makes it just a little more fun


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
  •