Created
October 20, 2013 15:19
-
-
Save harveytoro/7070994 to your computer and use it in GitHub Desktop.
Simple script that I am using with Twilio to send my CV to anyone that sends their email address to my Twilio number or so I can send it to someone quickly with a quick sms message. Requirements:
PHPMailer (https://github.com/Synchro/PHPMailer)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
require_once('mailer/class.phpmailer.php'); | |
$myName = "YourName"; | |
$email_pattern = "/^([a-z0-9\.\-\+\_\']+)@[a-z0-9\-\+\_]+\.[a-z0-9\-\+\_]*(\.?)[a-z0-9]+$/"; | |
$email_address = trim($_POST['Body']); | |
$email = new PHPMailer(); | |
$email->From = 'FromEmail'; | |
$email->AddReplyTo('FromEmail', $myName); | |
$email->Mailer = 'mail'; | |
$email->Hostname = 'youSpecify'; | |
$email->Sender = 'FromEmail'; | |
$email->FromName = $myName; | |
$email->Subject = ' CV'; | |
$email->Body = "Hi \n\n My CV is attatched for your convenience, please don't hesitate to contact me with any question. \n\n Kind regards, \n\n ".$myName; | |
$email->AddAddress($email_address); | |
$attach = './CV.pdf'; | |
$email->AddAttachment($attach , 'CV.pdf'); | |
if(preg_match($email_pattern, $email_address)){ | |
$email->Send(); | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment