Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- require_once "Mail.php";
- require_once "Mail/mime.php";
- $from = "Luis <luis@gyeeply.com;>";
- $to = "Rachel Recipient <javi@yeeply.com>";
- $subject = "Hi!";
- $text = "Hi,\n\nIt is a text message";
- $html = "It is a <b>HTML</b> message";
- $mime = new Mail_mime();
- $mime->setHTMLBody($html);
- $mime->setTXTBody($text);
- $body = $mime->get();
- $host = "smtpcorp.com"; // Enter 'ssl://' and your SMTP2GO account's SMTP server.
- $port = "2525"; // 8465 can also be used.
- $username = "luis@yeeply.com";
- $password = "PASS";
- $headers = array ('From' => $from,
- 'To' => $to,
- 'Subject' => $subject);
- $headers = $mime->headers($headers);
- $smtp = Mail::factory('smtp',
- array (
- 'host' => $host,
- 'port' => $port,
- 'auth' => true,
- 'username' => $username,
- 'password' => $password
- )
- );
- $mail = $smtp->send($to, $headers, $body);
- if (PEAR::isError($mail)) {
- echo("<p>" . $mail->getMessage() . "</p>");
- } else {
- echo("<p>Message successfully sent!</p>");
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement