Skip to content

Instantly share code, notes, and snippets.

@roelven
Created November 3, 2010 10:19
Show Gist options
  • Select an option

  • Save roelven/660935 to your computer and use it in GitHub Desktop.

Select an option

Save roelven/660935 to your computer and use it in GitHub Desktop.
Sendmail function with SwiftMailer
function sendMail($subject, $body, $receiver) {
$sender = array('no-reply@inzetkast.nl' => 'Inzetkast.nl');
$transport = Swift_SmtpTransport::newInstance('smtp.gmail.com', 465, 'ssl')
->setUsername('post@inzetkast.nl')
->setPassword('xxxx')
;
$mailer = Swift_Mailer::newInstance($transport);
$message = Swift_Message::newInstance($subject)
->setFrom($sender)
->setTo($receiver)
->setContentType('text/html')
;
$message->setBody($body);
error_log('YOURLOGMSG HERE');
$result = $mailer->send($message);
return true;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment