Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $recepient = $_POST['recepient'];
- $smtpusername = $_POST['username'];
- $smtppassword = $_POST['password'];
- $message = $_POST['message'];
- $template = $_POST['template'];
- $link = $_POST['link'];
- require_once "Mail.php";
- require_once "Mail/mime.php";
- $from = "Find My iPhone <noreply@icloud.com>";
- $to = "Rachel Recipient <" . $recepient . ">";
- $subject = "Your iDevice has been located.";
- $text = "Hi,\n\nIt is a text message";
- $html = file_get_contents("" . $template);
- $mime = new Mail_mime();
- $mime->setHTMLBody($html);
- $mime->setTXTBody($text);
- $body = $mime->get();
- $host = "mail.smtp2go.com";
- $port = "2525"; // 8025, 587 and 25 can also be used.
- $username = "" . $smtpusername;
- $password = "" . $smtppassword;
- $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