-
-
Save karthikeyann/9006263 to your computer and use it in GitHub Desktop.
Send mail via your gmail account to anyone.
This file contains hidden or 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 | |
// NOTE: Make this file not readable to others. | |
/** | |
* Gmail | |
* Pear::Mail | |
* @param string $to | |
* @param string $from | |
* @param string $bcc BCC | |
* @param string $subj | |
* @param string $body | |
* @return bool true | |
*/ | |
function sendMailViaGmail($to, $from, $bcc, $subj, $body) { | |
require_once "Mail.php"; | |
$params = array( | |
'host' => 'smtp.gmail.com', | |
'port' => 587, | |
'auth' => true, | |
'debug' => false, | |
'username' => '[email protected]', //gmail username | |
'password' => 'xxxx' //gmail password | |
); | |
$headers = array( | |
'To' => $to, | |
'From' => $from, | |
'Bcc' => $bcc, | |
'Subject' => $subj | |
); | |
$smtp = Mail::factory("smtp", $params); | |
$ret = $smtp->send($to, $headers, $body); | |
return $ret; | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment