Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static function sendMail($subject, $body, $address) {
- $mail = new PHPMailer();
- $mail->isSMTP();
- $mail->SMTPDebug = 2;
- $mail->Debugoutput = 'html';
- $mail->SMTPAuth = true;
- $mail->SMTPSecure = 'tls';
- $mail->Host = 'smtp.live.com';
- $mail->Port = 587;
- $mail->isHTML();
- $mail->Username = 'myMail@hotmail.com';
- $mail->Password = 'myMailPass';
- $mail->SetFrom('no-reply@gmail.com');
- $mail->Subject = $subject;
- $mail->Body = $body;
- $mail->AddAddress($address);
- $mail->Send();
- <?php
- require 'PHPMailer/PHPMailerAutoload.php';
- $mail = new PHPMailer;
- $mail->isSMTP();
- $mail->Charset = 'utf8_decode()';
- $mail->Host = 'smtp.live.com';
- $mail->Port = 587;
- $mail->SMTPSecure = 'tsl';
- $mail->SMTPAuth = true;
- $mail->isHTML(true);
- $mail->Username = "meuemail@hotmail.com";
- $mail->Password = "minhasenha";
- //Define os destinatário(s)
- //=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
- $mail->AddAddress('meuemail@hotmail.com');
- //Define o remetente
- // =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
- $mail->AddReplyTo($_POST['email'], utf8_decode($_POST['nome']));
- $mail->SetFrom($_POST['email'], utf8_decode($_POST['nome']));
- $mail->Subject = utf8_decode($_POST['assunto']);
- $mail->Body = utf8_decode($_POST['mensagem']);
- if (!$mail->send()) {
- echo "Mailer Error: " . $mail->ErrorInfo;
- } else {
- echo "<script>javascript:history.back(0)</script>";
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement