Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- require_once("Mail.php");
- $from = "Your Name <email@blahblah.com>";
- $to = "Their Name <otheremail@whatever.com>";
- $subject = "Subject";
- $body = "Lorem ipsum dolor sit amet, consectetur adipiscing elit...";
- $host = "mailserver.blahblah.com";
- $username = "smtp_username";
- $password = "smtp_password";
- $headers = array('From' => $from, 'To' => $to, 'Subject' => $subject);
- $smtp = Mail::factory('smtp', array ('host' => $host,
- 'auth' => true,
- 'username' => $username,
- 'password' => $password));
- $mail = $smtp->send($to, $headers, $body);
- if ( PEAR::isError($mail) ) {
- echo("<p>Error sending mail:<br/>" . $mail->getMessage() . "</p>");
- } else {
- echo("<p>Message sent.</p>");
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement