Jump to content

need help with mail class from pear


darkcarnival

Recommended Posts

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.

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


I really hope someone can help me with this

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

thanks.
Link to comment
https://forums.phpfreaks.com/topic/12165-need-help-with-mail-class-from-pear/
Share on other sites

Archived

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

×
×
  • Create New...

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.