/ Published in: PHP
Script to send mails with Swift Mailer
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
<?php require_once 'lib/swift_required.php'; include "conexion.php"; $correo = $_POST['correo']; //Mail Receiver //Create the Transport $transport = Swift_SmtpTransport::newInstance('smtp.gmail.com', 25) ->setPassword('password') ; /* You could alternatively use a different transport such as Sendmail or Mail: //Sendmail $transport = Swift_SendmailTransport::newInstance('/usr/sbin/sendmail -bs'); $transport = Swift_MailTransport::newInstance(); */ //Create the Mailer using your created Transport $mailer = Swift_Mailer::newInstance($transport); //Create a message $message = Swift_Message::newInstance('Banco de Ideas') ->setBody('Your message...') ; //Send the message $result = $mailer->send($message); /* You can alternatively use batchSend() to send the message $result = $mailer->batchSend($message); */ ?>