Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- require_once "Mail.php";
- $from = "Home Calendar <calendar@home>";
- $to = "Me Yahoo <me@yahoo.co.uk>, Me Gmail <me@gmail.com>";
- $subject = "TESTING PHP EMAIL";
- $body = "
- <html>
- <head>
- <title>HTML email</title>
- </head>
- <body>
- <p>This email contains HTML Tags!</p>
- <table>
- <tr>
- <th>Firstname</th>
- <th>Lastname</th>
- </tr>
- <tr>
- <td>Ricardo</td>
- <td>Wagemaker</td>
- </tr>
- </table>
- </body>
- </html>
- ";
- $host = "ssl://mail.domain.co.uk";
- $port = "465";
- $username = "name@domain.co.uk";
- $password = "password";
- $headers = array (
- "MIME-Version: 1.0",
- "Content-type: text/html; charset=ISO-8859-1",
- 'From' => $from,
- 'To' => $to,
- 'Subject' => $subject
- );
- $smtp = Mail::factory('smtp',
- array ('host' => $host,
- 'port' => $port,
- 'auth' => true,
- 'username' => $username,
- 'password' => $password));
- $mail = $smtp->send($to, $headers, $body, $from, $subject);
- if (PEAR::isError($mail)) {
- echo("<p>" . $mail->getMessage() . "</p>");
- } else {
- echo("nn<p>Message successfully sent!</p>nn");
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement