SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Enthusiast yjgx007's Avatar
    Join Date
    Jul 2004
    Location
    China or Singapore?
    Posts
    30
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Unhappy Help me, can't to send mail in PHP!

    My system settings:
    PHP4.3.6, Linux FreeBSD, Apache 1.3.2

    The Linux already have install "sendmail" program and to set \usr\local\lib\php.ini, like below :
    ------------------------------------------
    ; For Unix only. You may supply arguments as well (default: "sendmail -t -i").
    sendmail_path = "/usr/sbin/sendmail -t -i"

    ------------------------------------------

    codes for sending mail:
    note: demonstration PHP standard codes to send mail, real codes referer it.
    ------------------------------------------
    PHP Code:
    <?php
    /* recipients */
    $to  "mary@example.com" ", " // note the comma
    $to .= "kelly@example.com";

    /* subject */
    $subject "Birthday Reminders for August";

    /* message */
    $message '
    <html>
    <head>
     <title>Birthday Reminders for August</title>
    </head>
    <body>
    <p>Here are the birthdays upcoming in August!</p>
    <table>
     <tr>
      <th>Person</th><th>Day</th><th>Month</th><th>Year</th>
     </tr>
     <tr>
      <td>Joe</td><td>3rd</td><td>August</td><td>1970</td>
     </tr>
     <tr>
      <td>Sally</td><td>17th</td><td>August</td><td>1973</td>
     </tr>
    </table>
    </body>
    </html>
    '
    ;

    /* To send HTML mail, you can set the Content-type header. */
    $headers  "MIME-Version: 1.0\r\n";
    $headers .= "Content-type: text/html; charset=iso-8859-1\r\n";

    /* additional headers */
    $headers .= "To: Mary <mary@example.com>, Kelly <kelly@example.com>\r\n";
    $headers .= "From: Birthday Reminder <birthday@example.com>\r\n";
    $headers .= "Cc: [email]birthdayarchive@example.com[/email]\r\n";
    $headers .= "Bcc: [email]birthdaycheck@example.com[/email]\r\n";

    /* and now mail it */
    mail($to$subject$message$headers);
    ?>

  2. #2
    <? james('rules'); ?>
    Join Date
    Jun 2004
    Location
    Wales, UK
    Posts
    788
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    This functioning PHP mail code, tell me if you want an explanation:
    PHP Code:
    if ($_GET)
        {
        
    $fmail=$_GET['useremail'];
        
    // Get the password from the database
        
    $host="localhost";
        
    $username="*******";
        
    $password="******";
        
    $db="techsusers";
        
    mysql_connect($host$username$password);
        
    mysql_select_db($db)or die("Could not select the database");
        
    $pass="SELECT password FROM users WHERE email='$fmail'";
        
    $result=mysql_query($pass)or die ("Could not get the password.");
        
    $row mysql_fetch_assoc($result);
        
    $pass $row['password'];
        if(
    mysql_num_rows($result) < 1) {
        echo 
    "There was no password to retreive. This could be because you entered an invalid e-mail address.";
        }
        else {
        
    // Compose the message
        
    $message "Message from ubertr0tt.com Admin: You requested to be e-mailed your forgotten password. It is: $pass. Thank you for using this service.";
        
    // Send the message to the e-mail
        
    if(mail($fmail"ubertr0tt Recovery"$message"From: [email]admin@ubertr0tt.com[/email]"))
        {
        echo 
    "The password will be e-mailed to <b>$fmail</b> shortly.";
        }
        }
    }

    Edit this how you want etc. I don't know if linux will effect it or what, im just a PHP coder .
    If knowledge is power - Why isn't our army librarians?!
    Statistics show that 63% of all statistics are fake.
    When i was little i broke my neck, and i havent looked back since .
    I completed the internet in 1 week. The end boss was pretty easy though .

  3. #3
    SitePoint Zealot Scott.Mc's Avatar
    Join Date
    Jul 2004
    Location
    Scotland
    Posts
    158
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    your mail server info looks fine.

    its probley just your code headers.
    Linux Server Management - AdminGeekZ.com
    Is your website Sluggish? Unavailable? Insecure?

    Why not call us? +44 0141 2800134

  4. #4
    SitePoint Enthusiast yjgx007's Avatar
    Join Date
    Jul 2004
    Location
    China or Singapore?
    Posts
    30
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by BreakOutHosting
    your mail server info looks fine.

    its probley just your code headers.
    would you further explain your mean particular?

  5. #5
    SitePoint Enthusiast yjgx007's Avatar
    Join Date
    Jul 2004
    Location
    China or Singapore?
    Posts
    30
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    like sitepoint using PHP to send mail that how to do?


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
  •