Skip to content

Instantly share code, notes, and snippets.

@raulfraile
Created April 15, 2015 12:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save raulfraile/8b87792f1ecbca520191 to your computer and use it in GitHub Desktop.
Save raulfraile/8b87792f1ecbca520191 to your computer and use it in GitHub Desktop.
ServerGrove mail checker
<?php
<<<CONFIG
packages:
- "swiftmailer/swiftmailer: ~5.0"
CONFIG;
$from = $argv[1];
$to = $argv[2];
$transport = \Swift_SmtpTransport::newInstance('mail.servergrove.com', 25)
->setUsername($from)
->setPassword($argv[3]);
$mailer = Swift_Mailer::newInstance($transport);
$message = Swift_Message::newInstance('Test message')
->setFrom($from)
->setTo($to)
->setBody('Hello world')
;
$result = $mailer->send($message);
if (1 === $result) {
echo 'OK' . PHP_EOL;
} else {
echo 'ERROR' . PHP_EOL;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment