Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
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