Jump to content


This topic is now archived and is closed to further replies.


need help with mail class from pear

Recommended Posts


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.

[code] #form data.
$name = $_POST['name'];
$email = $_POST['email'];
$comment = $_POST['comment'];
#send email.
#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:

$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.";[/code]

I really hope someone can help me with this

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


Share this post

Link to post
Share on other sites


Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.