Скрипт:
PHP:
скопировать код в буфер обмена
скопировать код в буфер обмена
- <?PHP
- // $Id$
- require_once '/swift/swift_required.php';
- //$send_charset = 'KOI8-R'; // кодировка письма
- function sendmail3($to,$subject,$body)
- {
- $from="";
- $pass="";
- // Create the message
- $message = Swift_Message::newInstance();
- $message->setSubject($subject);
- // Set the From address with an associative array
- // Set the To addresses with an associative array
- // Give it a body
- //$message->setBody($body);//'Here is the message itself');
- // And optionally an alternative body
- $message->addPart($body/*'<q>Here is the message itself</q>'*/, 'text/html');
- ////////////////////
- $transport = Swift_SmtpTransport::newInstance('smtp.mail.ru', 25);
- $transport->setUsername($from);//'ecp2012test@mail.ru');
- $transport->setPassword($pass);//'P@ssw0rd13579');
- $mailer = Swift_Mailer::newInstance($transport);
- // Send the message
- $result = $mailer->send($message);
- return $result;
- }
- sendmail3("$email","Ваш комментарий.","Вы оставили комментарий на сайте :<br> Привет ");
- echo " На ваш email выслано письмо!!!";