Odoslanie mailu cez SMTP
Popis niektorých parametrov pre odoslanie mailu:
Príjemca mailu: $email
Kópia mailu: $this->adminMail
Subjekt: $subject
Správa: $body
require_once( PATH_INC.'mailer/class.phpmailer.php' );
/**
* Plugin 'Mailer'
*
* @author Robert Gonda <robert.gonda@gmail.com>
*/
class mailer {
// SMTP server settings
var $smtpHost = 'mail.server.sk';
var $smtpUsername = 'username@server.sk';
var $smtpPassword = 'abcdef';
// Sender values
var $smtpSender = 'from@server.sk';
var $smtpFrom = 'from@server.sk';
var $smtpFromName = 'From name';
// Admin email
var $adminMail = 'admin@server.sk';
/**
* Send HTML email using SMTP
*
* @param string $email: recipient email
* @param string $subject: subject
* @param string $body: email HTML content
* @return void
*/
function sendMailSMTP( $email, $subject, $body ) {
$smtp = new PHPMailer();
$smtp->IsSMTP();
$smtp->Host = $this->smtpHost;
$smtp->SMTPAuth = true;
$smtp->Username = $this->smtpUsername;
$smtp->Password = $this->smtpPassword;
$smtp->AddAddress( $email );
$smtp->AddBCC( $this->adminMail );
$smtp->Sender = $this->smtpSender;
$smtp->From = $this->smtpFrom;
$smtp->FromName = $this->smtpFromName;
$smtp->AddCustomHeader( 'X-Sender-IP: '.$_SERVER['REMOTE_ADDR'] );
$smtp->CharSet = 'utf-8';
$smtp->Subject = $subject;
$smtp->Body = $body;
$smtp->AltBody = strip_tags( $body );
$smtp->IsHTML( true );
return $smtp->Send();
}
}
| Žiadne dokumenty ani odkazy k tejto stránke. | ||
Generátor typoscriptu
Vytvára typoscript pre bežné použitie. Generátor je jednoduchý na obsluhu, stačí vyplniť zopár položiek formulára.