Jump to content

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.