Created
October 9, 2013 07:22
-
-
Save sineld/6897468 to your computer and use it in GitHub Desktop.
This file contains 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 | |
require("PHPMailer/class.phpmailer.php"); | |
function sinMailer($kimeEmail, $kimeAd = FALSE, $mailKonu, $mailMesaj, $kimdenEmail = FALSE, $kimdenAd = FALSE){ | |
$kimeAd = $kimeAd ? $kimeAd : $kimeEmail; | |
$mail = new PHPMailer(); | |
$mail->IsSMTP(); | |
$mail->CharSet = "UTF-8"; | |
$mail->Host = "smtp.mandrillapp.com"; | |
$mail->SMTPAuth = true; | |
$mail->Port = 587; | |
// $mail->SMTPSecure = "ssl"; | |
// $mail->SMTPKeepAlive = true; | |
$mail->Username = "mandrillappusername@gmail.com"; | |
$mail->Password = "mandrillappAPIkey"; | |
if($kimdenEmail){ | |
$kimdenAd = $kimdenAd ? $kimdenAd : $kimdenEmail; | |
$mail->SetFrom($kimdenEmail, $kimdenAd); | |
}else{ | |
$mail->SetFrom('youremailaddress@gmail.com', 'Sender Name'); | |
} | |
// $mail->AddReplyTo('youremailaddress@gmail.com', 'Sender Name'); | |
$mail->Subject = $mailKonu; | |
$mail->MsgHTML($mailMesaj); | |
$mail->AddAddress($kimeEmail, $kimeAd); | |
if(!$mail->Send()) | |
{ | |
return FALSE; | |
// echo $mail->ErrorInfo; | |
} | |
else | |
{ | |
return TRUE; | |
} | |
// $mail->ClearAddresses(); | |
} | |
if(sinMailer('receiver@gmail.com', 'To Name', 'E-mail Subject')) | |
{ | |
echo 'email sent :)'; | |
} | |
else | |
{ | |
echo 'email failed :('; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment