本文整理汇总了PHP中phpmailer::send方法的典型用法代码示例。如果您正苦于以下问题:PHP phpmailer::send方法的具体用法?PHP phpmailer::send怎么用?PHP phpmailer::send使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类phpmailer
的用法示例。
在下文中一共展示了phpmailer::send方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: phpmailer
function f_SEND($t_email = '', $t_asunto = '', $t_contenido)
{
require_once '../modelo/phpmailer/class.phpmailer.php';
$a_email = new phpmailer();
$a_email->Mailer = "smtp";
$a_email->Host = "";
$a_email->SMTPAuth = true;
$a_email->Port = '465';
$a_email->CharSet = 'utf8';
$a_email->Username = '';
$a_email->Password = '';
$a_email->From = '';
$a_email->FromName = '' . utf8_decode('');
//escribir la el contenido del correo
//dirección destino
$a_correo = '' . $t_email;
$a_email->addAddress($a_correo);
$a_email->Subject = '' . utf8_decode('' . $t_asunto);
$a_email->AddEmbeddedImage('../imagenes/inen_header.png', 'logoinen', 'inen_header.png');
$a_email->IsHTML(true);
$a_email->Body = "<p><img src=\"cid:logoinen\" /></p><p>" . utf8_decode('' . $t_contenido) . "</p>";
$a_email->AltBody = ' ';
if ($a_email->send()) {
echo "</br>Mensaje enviado correctamente.</br>";
} else {
echo "<br/><strong>Información:</strong><br/>" . $a_email->ErrorInfo;
}
}
示例2: send_mail
function send_mail($email, $date, $time)
{
require '../phpmailer/PHPMailerAutoload.php';
$mail = new phpmailer();
$mail->isSMTP();
$mail->Host = 'smtp.gmail.com';
$mail->SMTPAuth = true;
$mail->Username = 'sulemartin87@gmail.com';
$mail->Password = 'Kisamymum96';
$mail->SMTPSecure = 'tls';
$mail->Port = 587;
$mail->setFrom('sulemartin87@gmail.com', 'Mailer');
$mail->addAddress('' . $email . '', 'user');
$mail->isHTML(true);
$mail->Subject = 'booking';
$mail->Body = 'This email is coming from global styling to: ' . $email . ' </br>
your booking is set for ' . $date . ' at ' . $time . '
thank you for booking with us. Global Styling';
$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 to your E-Mail address';
}
}
示例3: sendmail
public function sendmail($from, $to, $subject, $body, $altbody = null, $options = null, $attachments = null, $html = false)
{
if (!is_array($from)) {
$from = array($from, $from);
}
$mail = new phpmailer();
$mail->PluginDir = 'M/lib/phpmailer/';
if ($this->getConfig('smtp')) {
$mail->isSMTP();
$mail->Host = $this->getConfig('smtphost');
if ($this->getConfig('smtpusername')) {
$mail->SMTPAuth = true;
$mail->Port = $this->getConfig('smtpport') ? $this->getConfig('smtpport') : 25;
$mail->SMTPDebug = $this->smtpdebug;
$mail->Username = $this->getConfig('smtpusername');
$mail->Password = $this->getConfig('smtppassword');
}
}
$mail->CharSet = $this->getConfig('encoding');
$mail->AddAddress($to);
$mail->Subject = $subject;
$mail->Body = $note . $body;
$mail->AltBody = $altbody;
if (!is_array($from)) {
$from = array($from, $from);
}
$mail->From = $from[0];
$mail->FromName = $from[1];
if (key_exists('reply-to', $options)) {
$mail->AddReplyTo($options['reply-to']);
unset($options['reply-to']);
}
if (key_exists('Sender', $options)) {
$mail->Sender = $options['Sender'];
}
if (null != $attachments) {
if (!is_array($attachments)) {
$attachments = array($attachments);
}
foreach ($attachments as $k => $v) {
if (!$mail->AddAttachment($v, basename($v))) {
trigger_error("Attachment {$v} could not be added");
}
}
}
$mail->IsHTML($html);
$result = $mail->send();
}
示例4: getDb
/**
* Returns database object
*
* @param boolean $blAssoc default false
*
* @throws oxConnectionException error while initiating connection to DB
*
* @return ADOConnection
*/
public static function getDb($blAssoc = false)
{
global $ADODB_FETCH_MODE;
if ($blAssoc) {
$ADODB_FETCH_MODE = ADODB_FETCH_ASSOC;
} else {
$ADODB_FETCH_MODE = ADODB_FETCH_NUM;
}
if (defined('OXID_PHP_UNIT')) {
if (isset(modDB::$unitMOD) && is_object(modDB::$unitMOD)) {
return modDB::$unitMOD;
}
}
if (self::$_oDB !== null) {
return self::$_oDB;
}
global $ADODB_CACHE_DIR;
global $ADODB_DRIVER, $ADODB_SESSION_TBL, $ADODB_SESSION_CONNECT, $ADODB_SESSION_DRIVER, $ADODB_SESSION_USER, $ADODB_SESSION_PWD, $ADODB_SESSION_DB, $ADODB_SESS_LIFE, $ADODB_SESS_DEBUG;
//adding exception handler for SQL errors
$myConfig = self::getInstance()->getConfig();
$iDebug = $myConfig->getConfigParam('iDebug');
if ($iDebug) {
include_once getShopBasePath() . 'core/adodblite/adodb-exceptions.inc.php';
}
// session related parameters. don't change.
//Tomas
//the default setting is 3000 * 60, but actually changing this will give no effect as now redefinition of this constant
//appears after OXID custom settings are loaded and $ADODB_SESS_LIFE depends on user settings.
//You can find the redefinition of ADODB_SESS_LIFE @ oxconfig.php:: line ~ 390.
$ADODB_SESS_LIFE = 3000 * 60;
$ADODB_SESSION_TBL = "oxsessions";
$ADODB_SESSION_DRIVER = $myConfig->getConfigParam('dbType');
$ADODB_SESSION_USER = $myConfig->getConfigParam('dbUser');
$ADODB_SESSION_PWD = $myConfig->getConfigParam('dbPwd');
$ADODB_SESSION_DB = $myConfig->getConfigParam('dbName');
$ADODB_SESSION_CONNECT = $myConfig->getConfigParam('dbHost');
$ADODB_SESS_DEBUG = false;
$ADODB_CACHE_DIR = $myConfig->getConfigParam('sCompileDir');
$sModules = '';
if ($iDebug == 2 || $iDebug == 3 || $iDebug == 4 || $iDebug == 7) {
$sModules = 'perfmon';
}
// log admin changes ?
if ($myConfig->isAdmin() && $myConfig->getConfigParam('blLogChangesInAdmin')) {
$sModules = ($sModules ? ':' : '') . 'oxadminlog';
}
self::$_oDB = ADONewConnection($myConfig->getConfigParam('dbType'), $sModules);
$sVerPrefix = '';
$sVerPrefix = '_ce';
if (!self::$_oDB->connect($myConfig->getConfigParam('dbHost'), $myConfig->getConfigParam('dbUser'), $myConfig->getConfigParam('dbPwd'), $myConfig->getConfigParam('dbName'))) {
$sConfig = join('', file(getShopBasePath() . 'config.inc.php'));
if (strpos($sConfig, '<dbHost' . $sVerPrefix . '>') !== false && strpos($sConfig, '<dbName' . $sVerPrefix . '>') !== false) {
header('location:setup/index.php');
// pop to setup as there is something wrong
oxUtils::getInstance()->showMessageAndExit("");
} else {
// notifying shop owner about connection problems
$sFailedShop = isset($_REQUEST['shp']) ? addslashes($_REQUEST['shp']) : 'Base shop';
$sDate = date('l dS of F Y h:i:s A');
$sScript = $_SERVER['SCRIPT_NAME'] . '?' . $_SERVER['QUERY_STRING'];
$sReferer = $_SERVER['HTTP_REFERER'];
//sending a message to admin
$sWarningSubject = 'Offline warning!';
$sWarningBody = "\n Database error in OXID eShop:\n Date: {$sDate}\n Shop: {$sFailedShop}\n\n mysql error: " . self::$_oDB->errorMsg() . "\n mysql error no: " . self::$_oDB->errorNo() . "\n\n Script: {$sScript}\n Referer: {$sReferer}";
if ($sAdminEmail = $myConfig->getConfigParam('sAdminEmail')) {
include 'core/phpmailer/class.phpmailer.php';
$oMailer = new phpmailer();
$oMailer->isMail();
$oMailer->From = $sAdminEmail;
$oMailer->AddAddress($sAdminEmail);
$oMailer->Subject = $sWarningSubject;
$oMailer->Body = $sWarningBody;
$oMailer->send();
}
//only exception to default construction method
$oEx = new oxConnectionException();
$oEx->setMessage('EXCEPTION_CONNECTION_NODB');
$oEx->setConnectionError($myConfig->getConfigParam('dbUser') . 's' . getShopBasePath() . self::$_oDB->errorMsg());
throw $oEx;
}
}
if ($iDebug == 2 || $iDebug == 3 || $iDebug == 4 || $iDebug == 7) {
try {
self::$_oDB->execute('truncate table adodb_logsql;');
} catch (ADODB_Exception $e) {
// nothing
}
self::$_oDB->logSQL(true);
}
self::$_oDB->cacheSecs = 60 * 10;
// 10 minute caching
//.........这里部分代码省略.........
示例5: header
$email_body .= "Email: " . $email . "\n";
$email_body .= "Suggested Item\n";
$email_body .= "Category: " . $category . "\n";
$email_body .= "Title: " . $title . "\n";
$email_body .= "Format: " . $format . "\n";
$email_body .= "Genre: " . $genre . "\n";
$email_body .= "Year: " . $year . "\n";
$email_body .= "Details: " . $details . "\n";
$mail->setFrom($email, $name);
$mail->addAddress('info@daishodesign.com', 'Daisho');
// Add a recipient
$mail->isHTML(false);
// Set email format to HTML
$mail->Subject = 'Personal Media Library Suggestion from ' . $name;
$mail->Body = $email_body;
if ($mail->send()) {
header("location:suggest.php?status=thanks");
exit;
}
$error_message = 'Message could not be sent.';
$error_message .= 'Mailer Error: ' . $mail->ErrorInfo;
}
}
$pageTitle = "Suggest a Media Item";
$section = "suggest";
include "inc/header.php";
?>
<div class="section page">
<div class="wrapper">
示例6: sendMail
/**
author:coster
date:7.5.06
sendet ein mail, mail wird nicht gesendet, falls programm im demo mode.
*/
function sendMail($from, $to, $subject, $message)
{
if (DEMO != true && !empty($from)) {
$to = remove_headers($to);
$message = remove_headers($message);
$subject = remove_headers($subject);
$from = remove_headers($from);
//add <br/> after \n
$message = nl2br($message);
//initialize php mailer to send html messages:
$mailer = new phpmailer();
$mailer->CharSet = "iso-8859-1";
$mailer->From = $from;
$mailer->FromName = $from;
$mailer->Subject = $subject;
$mailer->Body = $message;
$mailer->WordWrap = true;
$mailer->IsHTML(true);
$mailer->AddAddress($to);
$mailer->send();
//mail($to, unhtmlentities($subject), $message, "From: $from\nReply-To: $from\nX-Mailer: PHP/" . phpversion());
}
}
示例7: informAdminAboutRejectedMail
/**
* Inform the admin about a reject
*
* If an email could not be sent, inform the administrator
* about that (only if the option to do so was set)
* @author Stefan Heinemann <sh@adfinis.com>
* @param int $newsletterID
* @param int $userID
* @param string $email
* @param const
*/
protected function informAdminAboutRejectedMail($newsletterID, $userID, $email, $type)
{
// Get the current user's email address
$addy = \FWUser::getFWUserObject()->objUser->getEmail();
\Env::get('ClassLoader')->loadFile(ASCMS_LIBRARY_PATH . '/phpmailer/class.phpmailer.php');
$mail = new \phpmailer();
$newsletterValues = $this->getNewsletterValues($newsletterID);
if ($newsletterValues['smtp_server'] > 0) {
if (($arrSmtp = \SmtpSettings::getSmtpAccount($newsletterValues['smtp_server'])) !== false) {
$mail->IsSMTP();
$mail->Host = $arrSmtp['hostname'];
$mail->Port = $arrSmtp['port'];
$mail->SMTPAuth = $arrSmtp['username'] == '-' ? false : true;
$mail->Username = $arrSmtp['username'];
$mail->Password = $arrSmtp['password'];
}
}
$mail->CharSet = CONTREXX_CHARSET;
$mail->From = $newsletterValues['sender_email'];
$mail->FromName = $newsletterValues['sender_name'];
$mail->AddReplyTo($newsletterValues['return_path']);
$mail->Subject = $newsletterValues['subject'];
$mail->Priority = $newsletterValues['priority'];
$mail->Body = $this->getInformMailBody($userID, $email, $type);
$mail->AddAddress($addy);
$mail->send();
}
示例8: send
public function send()
{
$this->AltBody = strip_tags(stripslashes($this->Body)) . "\n\n";
$this->AltBody = str_replace(" ", "\n\n", $this->AltBody);
return parent::send();
}
示例9: phpmailer
function send_mail()
{
require 'phpmailer/PHPMailerAutoload.php';
$email = "";
$mail = new phpmailer();
$mail->isSMTP();
$mail->Host = 'smtp.gmail.com';
$mail->SMTPAuth = true;
$mail->Username = 'sulemartin87@gmail.com';
$mail->Password = 'Kisamymum96';
$mail->SMTPSecure = 'tls';
$mail->Port = 587;
$mail->setFrom('sulemartin87@gmail.com', 'Mailer');
$mail->addAddress('martinsuleman@rocketmail.com', 'user');
$mail->isHTML(true);
$mail->Subject = 'The code works';
$mail->Body = 'This email is coming from <b> GLOBAL STYLING SALONS !! </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 to your E-Mail address';
}
}
示例10: _sendMail
/**
* Returns $oMailer instance
*
* @param string $sEmail email address
* @param string $sSubject subject
* @param string $sBody email body
*
* @return phpmailer
*/
protected function _sendMail($sEmail, $sSubject, $sBody)
{
include_once getShopBasePath() . 'core/phpmailer/class.phpmailer.php';
$oMailer = new phpmailer();
$oMailer->isMail();
$oMailer->From = $sEmail;
$oMailer->AddAddress($sEmail);
$oMailer->Subject = $sSubject;
$oMailer->Body = $sBody;
return $oMailer->send();
}
示例11: phpmailer
$mail = new phpmailer();
$mail->isSMTP();
// Set mailer to use SMTP
$mail->Host = SMTP_HOST;
// Specify main and backup SMTP servers
$mail->SMTPAuth = SMTP_AUTH;
// Enable SMTP authentication
$mail->Username = SMTP_USERNAME;
// SMTP username
$mail->Password = SMTP_PASSWORD;
// SMTP password
$mail->SMTPSecure = SMTP_SECURE;
// Enable TLS encryption, `ssl` also accepted
$mail->Port = SMTP_PORT;
// TCP port to connect to
$mail->From = $from;
$mail->FromName = APP_TITLE;
$mail->addAddress($to);
// Name is optional
$mail->isHTML(true);
// Set email format to HTML
$mail->Subject = $subject;
$mail->Body = $html_text;
$mail->send();
$result = array("error" => false, "error_code" => ERROR_SUCCESS);
}
}
}
echo json_encode($result);
exit;
}
示例12: phpmailer
/*
get id for user
*/
require 'connection.php';
$query = $conn->prepare("SELECT email FROM messages WHERE id=?");
$query->bindValue(1, $id, PDO::PARAM_INT);
$query->execute();
$result = $query->fetch(PDO::FETCH_ASSOC);
extract($result);
require_once 'phpmailer/PHPMailerAutoload.php';
$m = new phpmailer();
$m->isSMTP();
$m->SMTPAuth = true;
$m->Host = 'smtpout.secureserver.net';
$m->username = 'jojoallowz';
$m->password = 'Jalal369allowz';
$m->SMTPSecure = 'ssl';
$m->Port = '465';
$m->From = 'admin@pixllart.com';
$m->FromName = 'pixllart.com';
$m->addReplyTo('', '');
$m->addAddress($email, '');
$m->isHtml(true);
$m->subject = 'frist message';
$m->Body = '<p>$msg</p><br><br> <img src="image/' . $img_name . '">';
$m->AltBody = '';
if ($m->send()) {
echo "sent";
} else {
echo $m->ErrorInfo;
}
示例13: autosend
* @param string mailto address
* @param string mail content
* @param array word replace rules
*
*/
public static function autosend($mailto, $content, $replace = null)
{
foreach ($replace as $k => $v) {
$content = str_replace($k, $v, $content);
}
$to = array();
if (is_string($mailto)) {
$to[0] = $mailto;
}
assert(trim($mailto) == '');
Mail::_send($to, $content);
}
/**
* Basic send function.
* @param array mailto list
* @param string content
* @param array attachment path list
*/
private static function _send($mailto, $content, $title = '', $attachment = null)
{
require_once 'phpmailer/class.phpmailer.php';
#echo "Begin!<br/>";
if ($title == '') {
$title = '来自IBM Power大赛官方的自动邮件,请勿直接回复本邮件。';
}
$mail = new phpmailer();
// defaults to using php "mail()"
$mail->IsSmtp();
// telling the class to use SendMail transport
#$body = 'hello cxj!<br/>';
#$body = eregi_replace("[\]",'',$body);
$config = C('PHPMAILER');
$address = $config['FROM'];
$password = $config['PASSWORD'];
$smtp = $config['HOST'];
$port = $config['PORT'];
#$mail->AddReplyTo($address,"First Last");
foreach ($mailto as $m) {
$mail->AddAddress($m, "Power大赛参赛选手 {$m} ");
}
$mail->SMTPAuth = true;
//$mail->from = $address;
//$mail->to = $address;
$mail->smtpsecure = 'ssl';
$mail->From = $address;