UnixServerAdmin

Server Administration & Management

PHP Mailing Script – 2

<?php
include(“Mail.php”);

/* mail setup recipients, subject etc */
$recipients = “feedback@userdomain.com”;
$headers[“From”] = “user@userdomain.com”;
$headers[“To”] = “feedback@userdomain.com”;
$headers[“Subject”] = “User feedback”;
$mailmsg = “Hello, This is a test.”;

/* SMTP server name, port, user/passwd */
$smtpinfo[“host”] = “smtp.userdomain.com”;
$smtpinfo[“port”] = “25”;
$smtpinfo[“auth”] = true;
$smtpinfo[“username”] = “smtpusername”;
$smtpinfo[“password”] = “smtpPassword”;

/* Create the mail object using the Mail::factory method */
$mail_object =& Mail::factory(“smtp”, $smtpinfo);

/* Ok send mail */
$mail_object->send($recipients, $headers, $mailmsg);
?>

Advertisements

March 26, 2011 - Posted by | PHP |

No comments yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: