Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- date_default_timezone_set('Etc/UTF-8');
- // Edit this path if PHPMailer is in a different location.
- require '../PHPMailer/PHPMailerAutoload.php';
- $Mailer->Charset='UTF-8';
- $mail = new PHPMailer;
- $mail->isSMTP();
- $mail->Charset='UTF-8';
- /*
- * Server Configuration
- */
- $mail->Host = 'smtp.gmail.com'; // Which SMTP server to use.
- $mail->Port = 587; // Which port to use, 587 is the default port for TLS security.
- $mail->SMTPSecure = 'tls'; // Which security method to use. TLS is most secure.
- $mail->SMTPAuth = true; // Whether you need to login. This is almost always required.
- $mail->Username = "###########"; // Your Gmail address.
- $mail->Password = "##########"; // Your Gmail login password or App Specific Password.
- /*
- * Message Configuration
- */
- $nome=addslashes($_POST['nome']);
- $time=addslashes($_POST['time']);
- $turma=addslashes($_POST['turma']);
- $mail->setFrom('$##############', 'Formulário de Contato'); // Set the sender of the message.
- $mail->addAddress('############', 'Suporte Josué'); // Set the recipient of the message.
- $mail->Subject = 'Formulário de Contato'; // The subject of the message.
- /*
- * Message Content - Choose simple text or HTML email
- */
- // Choose to send either a simple text email...
- $mail->Body = "Nome: ".$nome."\n Time: ".$time."\n Turma: ".$turma; // Set a plain text body.
- // ... or send an email with HTML.
- //$mail->msgHTML(file_get_contents('contents.html'));
- // Optional when using HTML: Set an alternative plain text message for email clients who prefer that.
- //$mail->AltBody = 'This is a plain-text message body';
- if( trim($nome) != "" || trim($time) != "" || trim($turma) != ""){
- if ($mail->send()) {
- echo '<script language="javascript">';
- echo 'alert("Email enviado com sucesso!");';
- echo "location.href='/EpicWeek/index.html';";
- echo '</script>';
- } else {
- echo "Mailer Error: " . $mail->ErrorInfo;
- }
- }else{
- echo '<script language="javascript">';
- echo 'alert("Não foi possivel enviar o e-mail! Há campos vazios!");';
- echo "location.href='/EpicWeek/index.html';";
- echo '</script>';
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement