Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <form method="post" action="phpmailer.php">
- <input type="text" placeholder="Nome" name="nome">
- <input type="email" placeholder="E-mail" name="email">
- <button type="submit">Enviar</button>
- </form>
- <?php
- require 'phpmailer/PHPMailerAutoload.php';
- $mail = new PHPMailer;
- $mail->isSMTP();
- $mail->Host = 'smtp.gmail.com';
- $mail->SMTPAuth = true;
- $mail->Username = '*********@gmail.com';
- $mail->Password = '*********';
- $mail->SMTPSecure = 'ssl'; // tls
- $mail->Port = 465; // 587
- $mail->setFrom('exemplo@exemplo.com', 'Exemplo');
- $mail->addAddress('exemplo@exemplo.com');
- $mail->addReplyTo('exemplo@exemplo.com', 'Exemplo');
- $mail->isHTML(true);
- $mail->Subject = 'Assunto';
- $mail->Body = 'Mensagem';
- $mail->AltBody = 'Mensagem';
- if(!$mail->send()){
- echo 'Message could not be sent.';
- echo 'Mailer Error: '.$mail->ErrorInfo;
- } else{
- echo 'Message has been sent';
- }
- ?>
- smtp error: failed to connect to server: network is unreachable (101)
Add Comment
Please, Sign In to add comment