Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- phpMail("to@example.com", $subject, $body, "from@example.com", "replyto@example.com");
- $mail = new PHPMailer;
- //$mail->SMTPDebug = 3; // Enable verbose debug output
- $mail->isSMTP(); // Set mailer to use SMTP
- $mail->Host = 'smtp.zoho.com'; // Specify main and backup SMTP servers
- $mail->SMTPAuth = true; // Enable SMTP authentication
- $mail->Username = '**REMOVED**'; // SMTP username
- $mail->Password = '**REMOVED**'; // SMTP password
- $mail->SMTPSecure = 'tls'; // Enable TLS encryption, `ssl` also accepted
- $mail->Port = 465; // TCP port to connect to
- $mail->isHTML(true); // Set email format to HTML
- // SYTAX: phpMail($from, $reply, $to, $subject, $body);
- function phpMail($to, $subject, $body, $from = "from@example.com", $reply = "replyto@example.com") {
- if (isset($from))
- $mail->From = $from;
- $mail->FromName = "testing";
- if (isset($to))
- $mail->addAddress($to);
- if (isset($reply))
- $mail->addReplyTo($reply);
- if (isset($subject))
- $mail->Subject = $subject;
- if (isset($body))
- $mail->Body = $body;
- $mail->AltBody = $body;
- if(!$mail->send()) {
- echo 'Message could not be sent.';
- echo 'Mailer Error: ' . $mail->ErrorInfo;
- } else {
- echo 'Message has been sent';
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement