Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- require 'phpmailer/PHPMailerAutoload.php';
- if(isset($_POST['send']))
- {
- $email = "info@mydomain.com";
- $password = "CXTYDF";
- $to_id = $_POST['toid'];
- $message = $_POST['message'];
- $subject = $_POST['subject'];
- $mail = new PHPMailer;
- $mail->isSMTP();
- $mail->Host = 'smtp.gmail.com';
- $mail->Port = 587;
- $mail->SMTPSecure = 'tls';
- $mail->SMTPAuth = true;
- $mail->Username = $email;
- $mail->Password = $password;
- $mail->setFrom('info@mydomain.com', 'TeamSupport');
- $mail->addReplyTo('info@mydomain.com', 'TeamSupport');
- $mail->addAddress($to_id);
- $mail->Subject = $subject;
- $mail->msgHTML($message);
- if (!$mail->send()) {
- $error = "Mailer Error: " . $mail->ErrorInfo;
- ?><script>alert('<?php echo $error ?>');</script><?php
- }
- else {
- echo '<script>alert("Message sent!");</script>';
- }
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement