Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $to = 'nobody@whateverdomain.com';
- $subject = 'the subject';
- $message = 'hello';
- $headers = 'From: webmaster@whateverdomain.com' . "rn" .
- 'Reply-To: webmaster@whateverdomain.com' . "rn" .
- 'X-Mailer: PHP/' . phpversion();
- mail($to, $subject, $message, $headers);
- ?>
- <?php
- require_once "Mail.php";
- $from = "Name Surname <sender@yourdomain.com>";
- $to = "Name Whatever <recipient@example.com>";
- $subject = "Subject!";
- $body = "Hi,nnHow are you?";
- $host = "mail.yourdomain.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>" . $mail->getMessage() . "</p>");
- } else {
- echo("<p>Message successfully sent!</p>");
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement