...

View Full Version : PHP Mailer



PRodgers4284
02-22-2008, 02:19 PM
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
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.';
}
?>

CFMaBiSmAd
02-22-2008, 02:37 PM
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.

PRodgers4284
02-22-2008, 02:46 PM
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

abduraooft
02-22-2008, 02:57 PM
Are you using Linux server? Have you checked the path of sendmail at your server? have you set the path in PHPMailer class?

PRodgers4284
02-22-2008, 03:07 PM
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?

rafiki
02-22-2008, 04:42 PM
do you have an smtp server on your localhost or smtp settings defined?

PRodgers4284
02-22-2008, 04:57 PM
What do i need to change for the yahoo smtp?

PRodgers4284
02-22-2008, 06:33 PM
Im still getting the error

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

with the following script:


<?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.';
}
?>

abduraooft
02-23-2008, 06:20 AM
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() (http://in.php.net/mail) function, which is actually calling the sendmail program (look the manual)

PRodgers4284
02-23-2008, 12:16 PM
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() (http://in.php.net/mail) function, which is actually calling the sendmail program (look the manual)


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

outseeker
02-23-2008, 02:34 PM
Have you checked out your php.ini? :) [mail function] I believe

PRodgers4284
02-23-2008, 05:29 PM
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"

EmmerDale
02-28-2008, 02:44 AM
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!

swordshadow
02-28-2008, 12:37 PM
just add this line:
$mail->SMTPAuth = true; // turn on SMTP authentication



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum