Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- if($_SERVER["REQUEST_METHOD"] == "POST"){
- //require('lib/phpmailer/class.smtp.php');
- // require('lib/phpmailer/class.phpmailer.php');
- //require('lib/phpmailer/PHPMailerAutoload.php');
- $mail = new PHPMailer();
- $errors = validator::check($form["struct"], $args);
- $to = 'social.media.wedo@gmail.com';
- $subject = $_POST['name']." ".$_POST['firstname'];
- $message = $_POST['content'];
- $headers = 'MIME-Version: 1.0' . "\r\n";
- $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
- var_dump($_POST);
- mail($to, $subject, $message, $headers);
- // $mail->isSMTP();
- $mail->IsMail(); // active SMTP
- $mail->SMTPDebug = 3; // debogage: 1 = Erreurs et messages, 2 = messages seulement
- $mail->SMTPSecure = 'tls'; // Gmail REQUIERT Le transfert securise
- $mail->Host = 'smtp.gmail.com';
- $mail->SMTPAuth = true;
- $mail->Username = 'social.media.wedo@gmail.com';
- $mail->Password = 'secret';
- $mail->Port = 587; // Par défaut
- // Expéditeur
- $mail->SetFrom($_POST['email'], 'kevin');
- // Destinataire
- $mail->AddAddress($to, $_POST['firstname']);
- // Objet
- $mail->Subject = $_POST['name'];
- // Votre message
- $mail->MsgHTML($_POST['content']);
- // Envoi du mail avec gestion des erreurs
- if(!$mail->Send()) {
- echo 'Erreur : ' . $mail->ErrorInfo;
- } else {
- echo 'Message envoyé !';
- }
- $mail->isSMTP(); // Set mailer to use SMTP
- $mail->Host = 'smtp.gmail.com'; // Specify main and backup SMTP servers
- $mail->SMTPAuth = true; // Enable SMTP authentication
- $mail->Username = 'social.media.wedo@gmail.com'; // SMTP username
- $mail->Password = 'secret'; // SMTP password
- $mail->SMTPSecure = 'tls'; // Enable TLS encryption, `ssl` also accepted
- $mail->Port = 587; // TCP port to connect to
- $mail->setFrom('social.media.wedo@gmail.com', 'kevin');
- $mail->addAddress('rajekevin@hotmail.fr'); // Add a recipient
- $mail->addReplyTo('social.media.wedo@gmail.com', 'Information');
- $mail->isHTML(true); // Set email format to HTML
- $mail->Subject = 'hello';
- $mail->Body = 'This is the HTML message body <b>in bold!</b>';
- $mail->AltBody = 'This is the body in plain text for non-HTML mail clients';
- 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