Results 1 to 7 of 7

Thread: Mail() Not Working

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Aug 2005
    Location
    South Africa
    Posts
    760

    Mail() Not Working

    I'm quite new to PHP.
    I've just built my first PHP form handler that will save the form data to a text file on my server and then email me an alert, but the Mail() function isn't sending me the email.
    I have set it to send to my gmail account but I don't receive it in my inbox or spam.

    How can I make it email me properly?
    If I helped you out, please consider adding to my reputation!

    -- "The faulty interface lies between the chair and the keyboard" --

    VB6 Programs By Me:
    ** Dictionary, Thesaurus & Rhyme-Generator In One ** WMP Recent Files List Editor ** Pretty Impressive Clock ** Extract Firefox History **

  2. #2
    Frenzied Member sciguyryan's Avatar
    Join Date
    Sep 2003
    Location
    Wales
    Posts
    1,763

    Re: Mail() Not Working

    Quote Originally Posted by shirazamod
    I'm quite new to PHP.
    I've just built my first PHP form handler that will save the form data to a text file on my server and then email me an alert, but the Mail() function isn't sending me the email.
    I have set it to send to my gmail account but I don't receive it in my inbox or spam.

    How can I make it email me properly?
    Can you post the code you are using?

    Cheers,

    Ryan Jones
    My Blog.

    Ryan Jones.

  3. #3
    <?="Moderator"?> john tindell's Avatar
    Join Date
    Jan 2002
    Location
    Brighton, UK
    Posts
    1,099

    Re: Mail() Not Working

    What server software are you using IIS, Apache, other? It could be that your SMTP server ins't set up correctly.

  4. #4

    Thread Starter
    Fanatic Member
    Join Date
    Aug 2005
    Location
    South Africa
    Posts
    760

    Re: Mail() Not Working

    OK, I've found that the problem is with my hosting company not allowing me to send email to other email addresses (eg: Gmail)

    Thanks for all the help,
    Shiraz
    If I helped you out, please consider adding to my reputation!

    -- "The faulty interface lies between the chair and the keyboard" --

    VB6 Programs By Me:
    ** Dictionary, Thesaurus & Rhyme-Generator In One ** WMP Recent Files List Editor ** Pretty Impressive Clock ** Extract Firefox History **

  5. #5
    Fanatic Member jcavard's Avatar
    Join Date
    Jul 2005
    Location
    Quebec, CANADA
    Posts
    534

    Re: Mail() Not Working

    Hi!

    I am trying to configure PHPMailer on my site to be able to submit a form with an attachement by email. I am using SMTP, I get none error but I don't receive any email...

    Code:
    <?php
    require("class.phpmailer.php");
    
    $mail = new phpmailer();
    
    $mail->From     = "[email protected]";
    $mail->FromName = "List manager";
    $mail->Host     = "localhost";     // I THINK I MIGHT BE HERE.....
    $mail->Mailer   = "smtp";
    
    // HTML body
    $body  = "Hello <font size=\"4\">FULL_NAME</font>, <p>";
    $body .= "<i>Your</i> personal photograph to this message.<p>";
    $body .= "Sincerely, <br>";
    $body .= "phpmailer List manager";
    
    // Plain text body (for mail clients that cannot read HTML)
    $text_body  = "Hello FULL_NAME, \n\n";
    $text_body .= "Your personal photograph to this message.\n\n";
    $text_body .= "Sincerely, \n";
    $text_body .= "phpmailer List manager";
    
    $mail->Body    = $body;
    $mail->AltBody = $text_body;
    $mail->AddAddress("[email protected]", "FULL_NAME"); // obviously, this is a dummy email only for this post...
    //$mail->AddStringAttachment($row["photo"], "YourPhoto.jpg");
    
    if(!$mail->Send())
        echo "There has been a mail error sending to " . $row["email"] . "<br>";
    
    // Clear all addresses and attachments for next loop
    $mail->ClearAddresses();
    $mail->ClearAttachments();
    
    ?>
    ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯

    accoustic emo-rock band: a tailormade fable

    Visual Studio 2003 / Framework 1.1

  6. #6
    <?="Moderator"?> john tindell's Avatar
    Join Date
    Jan 2002
    Location
    Brighton, UK
    Posts
    1,099

    Re: Mail() Not Working

    Have you setup your SMTP server to allow for PHP to relay message though it?

  7. #7
    Fanatic Member jcavard's Avatar
    Join Date
    Jul 2005
    Location
    Quebec, CANADA
    Posts
    534

    Re: Mail() Not Working

    hmm... I didnt not do anything else than coding a php file and uploading it to the server...

    So I guess I have to set it up? How can I do this??
    ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯

    accoustic emo-rock band: a tailormade fable

    Visual Studio 2003 / Framework 1.1

Posting Permissions

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



Click Here to Expand Forum to Full Width