Skip to content

Instantly share code, notes, and snippets.

@harveytoro
Created October 20, 2013 15:19
Show Gist options
  • Save harveytoro/7070994 to your computer and use it in GitHub Desktop.
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)
<?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