Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- if(empty($_POST['email']) ||
- empty($_POST['phone']) ||
- empty($_POST['message']) ||
- !filter_var($_POST['email'],FILTER_VALIDATE_EMAIL))
- {
- echo "No arguments Provided!";
- return false;
- }
- $email_address = $_POST['email'];
- $phone = $_POST['phone'];
- $message = $_POST['message'];
- ini_set('default_socket_timeout', 3);
- function smtp_mail($to, $from, $message, $user, $pass, $host, $port)
- {
- if ($h = fsockopen($host, $port))
- {
- $data = array(
- 0,
- "EHLO $host",
- 'AUTH LOGIN',
- base64_encode($user),
- base64_encode($pass),
- "MAIL FROM: <$from>",
- "RCPT TO: <$to>",
- 'DATA',
- $message
- );
- foreach($data as $c)
- {
- $c && fwrite($h, "$c\r\n");
- while(substr(fgets($h, 256), 3, 1) != ' '){}
- }
- fwrite($h, "QUIT\r\n");
- return fclose($h);
- }
- }
- $user = 'no.reply.tweetangels@gmail.com';
- $pass = 'pass';
- $host = 'ssl://smtp.gmail.com';
- //$host = 'ssl://email-smtp.us-east-1.amazonaws.com'; //Amazon SES
- $port = 465;
- $to = 'sales@tweetangels.com';
- $from = 'no.reply.tweetangels@gmail.com';
- $template = "Subject: Application from the site\r\n"
- ."To: <sales@tweetangels.com>\r\n"
- ."From: no.reply.tweetangels@gmail.com\r\n"
- ."MIME-Version: 1.0\r\n"
- ."Content-Type: text/html; charset=utf-8\r\n"
- ."Content-Transfer-Encoding: QUOTED-PRINTABLE\r\n\r\n"
- ."Email: $email_address <br>\r\n"
- ."Phone: $phone <br>\r\n"
- ."Message: $message\r\n"
- ."<br><br><br><hr>Coded By: <a href='http://www.facebook.com/slaki011/'>Slavisa</a>\r\n.";
- if(smtp_mail($to, $from, $template, $user, $pass, $host, $port))
- {
- echo "Mail sent\n\n";
- }
- else
- {
- echo "Some error occured\n\n";
- }
- return true;
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement