Your IP : 216.73.216.40


Current Path : /var/www/html/mmishra/irp/icure/
Upload File :
Current File : /var/www/html/mmishra/irp/icure/automailer.php

<?php

function automailer($email, $subject, $body) {
	//SMTP needs accurate times, and the PHP time zone MUST be set
	//This should be done in your php.ini, but this is how to do it if you don't have access to that
	date_default_timezone_set('Asia/Culcutta');

	require 'classes/PHPMailerAutoload.php';

	//Create a new PHPMailer instance
	$mail = new PHPMailer();

	//Tell PHPMailer to use SMTP
	$mail->isSMTP();

	//Set the hostname of the mail server
	$mail->Host = 'smtp.gmail.com';

	//Set the SMTP port number - 587 for authenticated TLS, a.k.a. RFC4409 SMTP submission
	$mail->Port = 587;

	//Set the encryption system to use - ssl (deprecated) or tls
	$mail->SMTPSecure = 'tls';

	//Whether to use SMTP authentication
	$mail->SMTPAuth = true;

	//Username to use for SMTP authentication - use full email address for gmail
	$mail->Username = "mmishra@iiita.ac.in";

	//Password to use for SMTP authentication
	$mail->Password = "happy@2015";

	//Set who the message is to be sent from
	$mail->setFrom('mmishra@iiita.ac.in', 'Automailer');

	//Set an alternative reply-to address
	//$mail->addReplyTo('mmishra@iiita.ac.in', 'Automailer');

	//Set who the message is to be sent to
	$mail->addAddress($email, $email);

	//Set the subject line
	$mail->Subject = $subject;

	$mail->Body = $body;

	//send the message, check for errors
	if (!$mail->send()) {
    		echo "Mailer Error: " . $mail->ErrorInfo;
	} else {
    		return TRUE;
	}
}
?>
</body>
</html>