Jump to content


Photo

need help with mail class from pear


  • Please log in to reply
No replies to this topic

#1 darkcarnival

darkcarnival
  • Members
  • PipPipPip
  • Advanced Member
  • 162 posts

Posted 16 June 2006 - 03:45 PM

hello,

after phpmailer has not met my needs, i decided to try pear's version of a mailing solution.

and I'm using the sendmail approach since my host recommends that.

now i wish to use it in a loop form for my newsletter system but in my testing the emails did not send but i got no error message. not sure if i screwed up or if its not ment to used that way but heres my code.

#form data.
$name = $_POST['name'];
$email = $_POST['email'];
$comment = $_POST['comment'];
#send email.
require("Mail.php");
#get values for class.
$headers['From']    = $email;
$headers['Subject'] = 'Mail Test';

$params['sendmail_path'] = '/usr/bin/sendmail';
// Create the mail object using the Mail::factory method
$mail_object =& Mail::factory('sendmail', $params);
#create a message
$message = "Hello,

$name has sent you a message:

$comment";
$body = $message;
#query time.
$q = mysql_query("select * from demo_list");
while($r = mysql_fetch_assoc($q)){
$recipients = $r['Email'];
$headers['To'] = $r['Email'];

$mail_object->send($recipients, $headers, $body);
}
echo "Email has been sent to the desired location.";


I really hope someone can help me with this

btw before you ask, yes im 100% sure the sendmail path is correct.

thanks.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users