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

Thread: PHP Mailer

  1. #1
    Regular Coder
    Join Date
    Jan 2008
    Posts
    216
    Thanks
    10
    Thanked 1 Time in 1 Post

    PHP Mailer

    Im trying out a phpmailer example but i cant seem to get it to send the email, im getting an error about the from address that it is being sent. Anyone got any ideas?

    PHP Code:
    <?php
    require("class.phpmailer.php");
    $mail = new PHPMailer();
    $mail->IsSMTP(); // telling the class to use SMTP
    $mail->Host "smtp.yahoo.com"// SMTP server
    $mail->Password '*********';
    $mail->From "*************@yahoo.com";
    $mail->AddAddress("************@yahoo.co.uk");
    $mail->Subject "First PHPMailer Message";
    $mail->Body "Hi! \n\n This is my first e-mail sent through PHPMailer.";
    $mail->WordWrap 50;

    if(!
    $mail->Send())
    {
       echo 
    'Message was not sent.';
       echo 
    'Mailer error: ' $mail->ErrorInfo;
    }
    else
    {
       echo 
    'Message has been sent.';
    }
    ?>

  • #2
    Senior Coder CFMaBiSmAd's Avatar
    Join Date
    Oct 2006
    Location
    Denver, Colorado USA
    Posts
    3,027
    Thanks
    2
    Thanked 315 Times in 307 Posts
    Posting the error is really the only way anyone will be able to help you. There could be a dozen different things wrong that could result in an error about the from address.
    If you are learning PHP, developing PHP code, or debugging PHP code, do yourself a favor and check your web server log for errors and/or turn on full PHP error reporting in php.ini or in a .htaccess file to get PHP to help you.

  • #3
    Regular Coder
    Join Date
    Jan 2008
    Posts
    216
    Thanks
    10
    Thanked 1 Time in 1 Post
    Quote Originally Posted by CFMaBiSmAd View Post
    Posting the error is really the only way anyone will be able to help you. There could be a dozen different things wrong that could result in an error about the from address.

    The error is just:

    Message was not sent.Mailer error: The following From address failed: *************@yahoo.com

  • #4
    Supreme Master coder! abduraooft's Avatar
    Join Date
    Mar 2007
    Location
    N/A
    Posts
    14,852
    Thanks
    160
    Thanked 2,223 Times in 2,210 Posts
    Blog Entries
    1
    Are you using Linux server? Have you checked the path of sendmail at your server? have you set the path in PHPMailer class?
    The Dream is not what you see in sleep; Dream is the thing which doesn't let you sleep. --(Dr. APJ. Abdul Kalam)

  • #5
    Regular Coder
    Join Date
    Jan 2008
    Posts
    216
    Thanks
    10
    Thanked 1 Time in 1 Post
    Quote Originally Posted by abduraooft View Post
    Are you using Linux server? Have you checked the path of sendmail at your server? have you set the path in PHPMailer class?
    No not using linux, im just using wamp on the localhost, i havent changed anything in the PHPMailer class, what do i need to change?
    Last edited by PRodgers4284; 02-22-2008 at 03:30 PM.

  • #6
    Senior Coder rafiki's Avatar
    Join Date
    Aug 2006
    Location
    Floating around somewhere...
    Posts
    2,046
    Thanks
    19
    Thanked 42 Times in 42 Posts
    do you have an smtp server on your localhost or smtp settings defined?

  • #7
    Regular Coder
    Join Date
    Jan 2008
    Posts
    216
    Thanks
    10
    Thanked 1 Time in 1 Post
    What do i need to change for the yahoo smtp?
    Last edited by PRodgers4284; 02-22-2008 at 06:11 PM.

  • #8
    Regular Coder
    Join Date
    Jan 2008
    Posts
    216
    Thanks
    10
    Thanked 1 Time in 1 Post
    Im still getting the error

    Message was not sent.Mailer error: The following From address failed: *************@yahoo.com

    with the following script:

    Code:
    <?php
    require("class.phpmailer.php");
    $mail = new PHPMailer();
    $mail->IsSMTP(); // telling the class to use SMTP
    $mail->Host = "smtp.mail.yahoo.com"; // SMTP server
    $mail->Username = '***********';
    $mail->Password = '*********';
    $mail->From = "*************@yahoo.com";
    $mail->AddAddress("*************@yahoo.com");
    
    $mail->Subject = "First PHPMailer Message";
    $mail->Body = "Hi! \n\n This is my first e-mail sent through PHPMailer.";
    $mail->WordWrap = 50;
    
    if(!$mail->Send())
    {
       echo 'Message was not sent.';
       echo 'Mailer error: ' . $mail->ErrorInfo;
    }
    else
    {
       echo 'Message has been sent.';
    }
    ?>

  • #9
    Supreme Master coder! abduraooft's Avatar
    Join Date
    Mar 2007
    Location
    N/A
    Posts
    14,852
    Thanks
    160
    Thanked 2,223 Times in 2,210 Posts
    Blog Entries
    1
    The PHPMailer class works with the help of sendmail program (usually comes along with linux). If you look in to the class file, you may see php's mail() function, which is actually calling the sendmail program (look the manual)
    The Dream is not what you see in sleep; Dream is the thing which doesn't let you sleep. --(Dr. APJ. Abdul Kalam)

  • #10
    Regular Coder
    Join Date
    Jan 2008
    Posts
    216
    Thanks
    10
    Thanked 1 Time in 1 Post
    Quote Originally Posted by abduraooft View Post
    The PHPMailer class works with the help of sendmail program (usually comes along with linux). If you look in to the class file, you may see php's mail() function, which is actually calling the sendmail program (look the manual)

    Hey thanks for the help, what exactly do i need to configure?

  • #11
    Regular Coder
    Join Date
    Feb 2008
    Location
    Australia baby!
    Posts
    143
    Thanks
    6
    Thanked 3 Times in 3 Posts
    Have you checked out your php.ini? [mail function] I believe
    outseeker - http://outer.reaches.dyndns.org/index.php
    I hope this helped someone. Due to this forums lame rep system penalising me for nothing, and admins inability to do anything about it, I'm sorry to say I will no longer be online here. Pride is important. Good Luck All.

  • #12
    Regular Coder
    Join Date
    Jan 2008
    Posts
    216
    Thanks
    10
    Thanked 1 Time in 1 Post
    Quote Originally Posted by outseeker View Post
    Have you checked out your php.ini? [mail function] I believe
    No, i wasnt sure what to change, do you know what i need change?

    I have been looking at the init file and found this, do i need to change this?

    ; Define the anonymous ftp password (your email address)
    ; from="joe@doe.com"
    Last edited by PRodgers4284; 02-23-2008 at 05:32 PM.

  • #13
    New to the CF scene
    Join Date
    Feb 2008
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Guess Who!

    Hehe! Dont you worry ur wee head mister Rodgers lol! I have the solution! Will be in contact with you later on 2day lol! Ur girlfriends not gona split up with ya now hahaha!
    Last edited by EmmerDale; 02-28-2008 at 02:46 AM.

  • #14
    New to the CF scene
    Join Date
    Feb 2008
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts
    just add this line:
    $mail->SMTPAuth = true; // turn on SMTP authentication


  •  

    Posting Permissions

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