本文整理汇总了PHP中SMTP类 的典型用法代码示例。如果您正苦于以下问题:PHP SMTP类的具体用法?PHP SMTP怎么用?PHP SMTP使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了SMTP类 的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: enviarcorreo
function enviarcorreo($datos)
{
//$objResponse = new xajaxResponse();
// Se incluye la librería necesaria para el envio
require_once "fzo.mail.php";
$prioridad = 3;
$mail = new SMTP("localhost", '[email protected] ', 'toyo694');
// Se configuran los parametros necesarios para el envío
$de = "[email protected] ";
$a = "[email protected] ";
$asunto = "Toyo Loba Import :: Formulario de Contactanos";
//$cc = $_POST['cc'];
//$bcc = $_POST['bcc'];
$cuerpo = "Nombre: " . $datos['nombre'] . "<br>" . "Empresa: " . $datos['empresa'] . "<br>" . "Telefono: " . $datos['telefono'] . "<br>" . "Mensaje: " . $datos['mensaje'] . "<br><br><br><br><br>" . "Este es un correo automatico enviado desde la página de Toyo Loba Import, c.a.";
$header = $mail->make_header($de, $a, $asunto, $prioridad, $cc, $bcc);
/* Pueden definirse más encabezados. Tener en cuenta la terminación de la linea con (\r\n)
$header .= "Reply-To: ".$_POST['from']." \r\n";
$header .= "Content-Type: text/plain; charset=\"iso-8859-1\" \r\n";
$header .= "Content-Transfer-Encoding: 8bit \r\n";
$header .= "MIME-Version: 1.0 \r\n";
*/
// Se envia el correo y se verifica el error
$error = $mail->smtp_send($de, $a, $header, $cuerpo, $cc, $bcc);
if ($error == "0") {
echo "E-mail enviado correctamente";
} else {
echo $error;
}
//return $objResponse;
}
开发者ID:jlobaton, 项目名称:inventario, 代码行数:31, 代码来源:ajax.php
示例2: foreach
/**
* Return an instance of f3 \SMTP populated with application settings
*
* @param array $data
* @return \SMTP
*/
public static function &getMailer(array $data = []) : \SMTP
{
$f3 = \Base::instance();
$smtp = new \SMTP($f3->get('email.host'), $f3->get('email.port'), $f3->get('email.scheme'), $f3->get('email.user'), $f3->get('email.pass'));
$smtp->set('From', $f3->get('email.from'));
// finally set other values like overrides
foreach ($data as $k => $v) {
$smtp->set($k, $v);
}
return $smtp;
}
开发者ID:vijinho, 项目名称:FFMVC, 代码行数:17, 代码来源:Mail.php
示例3: send_mail
function send_mail($name, $email, $ip, $is_spam, $message)
{
$subject = '';
if ($is_spam == false && empty($name) == false && empty($email) == false) {
$subject = $GLOBALS['CONTACT_SUBJECT'];
$smtp = new SMTP($GLOBALS['SMTP_SERVER'], $GLOBALS['SMTP_PORT']);
$smtp->mail_from($email);
return $smtp->send($GLOBALS['CONTACT_RECIPIENT'], $subject, "Name: " . $name . "\n\n" . stripslashes($message));
} else {
return true;
}
}
开发者ID:jasonlong, 项目名称:blackantmedia, 代码行数:12, 代码来源:contact.php
示例4: mail
/**
* 快捷发送一封邮件
* @param string $to 收件人
* @param string $sub 邮件主题
* @param string $msg 邮件内容(HTML)
* @param array $att 附件,每个键为文件名称,值为附件内容(可以为二进制文件),例如array('a.txt' => 'abcd' , 'b.png' => file_get_contents('x.png'))
* @return bool 成功:true 失败:错误消息
*/
public static function mail($to, $sub = '无主题', $msg = '无内容', $att = array())
{
if (defined("SAE_MYSQL_DB") && class_exists('SaeMail')) {
$mail = new SaeMail();
$options = array('from' => option::get('mail_name'), 'to' => $to, 'smtp_host' => option::get('mail_host'), 'smtp_port' => option::get('mail_port'), 'smtp_username' => option::get('mail_smtpname'), 'smtp_password' => option::get('mail_smtppw'), 'subject' => $sub, 'content' => $msg, 'content_type' => 'HTML');
$mail->setOpt($options);
$ret = $mail->send();
if ($ret === false) {
return 'Mail Send Error: #' . $mail->errno() . ' - ' . $mail->errmsg();
} else {
return true;
}
} else {
$From = option::get('mail_name');
if (option::get('mail_mode') == 'SMTP') {
$Host = option::get('mail_host');
$Port = intval(option::get('mail_port'));
$SMTPAuth = (bool) option::get('mail_auth');
$Username = option::get('mail_smtpname');
$Password = option::get('mail_smtppw');
$Nickname = option::get('mail_yourname');
if (option::get('mail_ssl') == '1') {
$SSL = true;
} else {
$SSL = false;
}
$mail = new SMTP($Host, $Port, $SMTPAuth, $Username, $Password, $SSL);
$mail->att = $att;
if ($mail->send($to, $From, $sub, $msg, $Nickname)) {
return true;
} else {
return $mail->log;
}
} else {
$name = option::get('mail_yourname');
$mail = new PHPMailer();
$mail->setFrom($From, $name);
$mail->addAddress($to);
$mail->Subject = $sub;
$mail->msgHTML($msg);
$mail->AltBody = 'To view the message, please use an HTML compatible email viewer!';
foreach ($att as $n => $d) {
$mail->addStringAttachment($d, "=?UTF-8?B?" . base64_encode($n) . "?=", 'base64', get_mime(get_extname($n)));
}
if (!$mail->send()) {
return $mail->ErrorInfo;
} else {
return true;
}
}
}
}
开发者ID:a1262344305, 项目名称:OpenShift-Tieba-Cloud-Sign, 代码行数:60, 代码来源:class.misc.php
示例5: checkSmtp
public function checkSmtp()
{
//Create a new SMTP instance
$smtp = new \SMTP();
//Enable connection-level debug output
$smtp->do_debug = \SMTP::DEBUG_CONNECTION;
try {
//Connect to an SMTP server
if ($smtp->connect($this->getSmtpServer()->getSmtpHost(), $this->getSmtpServer()->getSmtpPort())) {
//Say hello
if ($smtp->hello($this->smtp->getSmtpHost())) {
//Put your host name in here
//Authenticate
dump($this->getSmtpServer()->getSmtpUsername());
dump($this->getSmtpServer()->getSmtpPassword());
if ($smtp->authenticate($this->getSmtpServer()->getSmtpUsername(), $this->getSmtpServer()->getSmtpPassword())) {
return true;
} else {
throw new \Exception('Authentication failed: ' . $smtp->getLastReply());
}
} else {
throw new \Exception('HELO failed: ' . $smtp->getLastReply());
}
} else {
throw new \Exception('Connect failed');
}
} catch (\Exception $e) {
throw new \Exception('SMTP error: ' . $e->getMessage());
}
//Whatever happened, close the connection.
$smtp->quit(true);
}
开发者ID:diego3, 项目名称:myframework-core, 代码行数:32, 代码来源:PhpMailer.php
示例6: mail
/**
* 快捷发送一封邮件
* @param string $to 收件人
* @param string $sub 邮件主题
* @param string $msg 邮件内容(HTML)
* @param array $att 附件,每个键为文件名称,值为附件内容(可以为二进制文件),例如array('a.txt' => 'abcd' , 'b.png' => file_get_contents('x.png'))
* @return bool 成功:true 失败:错误消息
*/
public static function mail($to, $sub = '无主题', $msg = '无内容', $att = array())
{
if (defined("SAE_MYSQL_DB") && class_exists('SaeMail')) {
$mail = new SaeMail();
$options = array('from' => option::get('mail_name'), 'to' => $to, 'smtp_host' => option::get('mail_host'), 'smtp_port' => option::get('mail_port'), 'smtp_username' => option::get('mail_smtpname'), 'smtp_password' => option::get('mail_smtppw'), 'subject' => $sub, 'content' => $msg, 'content_type' => 'HTML');
$mail->setOpt($options);
$ret = $mail->send();
if ($ret === false) {
return 'Mail Send Error: #' . $mail->errno() . ' - ' . $mail->errmsg();
} else {
return true;
}
} else {
$From = option::get('mail_name');
if (option::get('mail_mode') == 'SMTP') {
$Host = option::get('mail_host');
$Port = intval(option::get('mail_port'));
$SMTPAuth = (bool) option::get('mail_auth');
$Username = option::get('mail_smtpname');
$Password = option::get('mail_smtppw');
$Nickname = option::get('mail_yourname');
if (option::get('mail_ssl') == '1') {
$SSL = true;
} else {
$SSL = false;
}
$mail = new SMTP($Host, $Port, $SMTPAuth, $Username, $Password, $SSL);
$mail->att = $att;
if ($mail->send($to, $From, $sub, $msg, $Nickname)) {
return true;
} else {
return $mail->log;
}
} else {
$header = "MIME-Version:1.0\r\n";
$header .= 'Content-type: text/html; charset=utf-8' . "\r\n";
$header .= "To: " . $to . "\r\n";
$header .= "From: " . $From . "\r\n";
$header .= "Subject: " . $sub . "\r\n";
$header .= 'Reply-To: ' . $From . "\r\n";
$header .= "Date: " . date("r") . "\r\n";
$header .= "Content-Transfer-Encoding: base64\r\n";
return mail($to, $sub, base64_encode($msg), $header);
}
}
}
开发者ID:wan-qy, 项目名称:Tieba-Cloud-Sign, 代码行数:54, 代码来源:class.misc.php
示例7: __construct
public function __construct()
{
$host = Controller::getEnvironmentData('SMTP_HOST');
$port = Controller::getEnvironmentData('SMTP_PORT');
$scheme = Controller::getEnvironmentData('SMTP_SCHEME');
$user = Controller::getEnvironmentData('SMTP_USER');
$pw = Controller::getEnvironmentData('SMTP_PASS');
parent::__construct($host, $port, $scheme, $user, $pw);
// error handling
$this->set('Errors-to', '' . Controller::getEnvironmentData('SMTP_ERROR') . '>');
$this->set('MIME-Version', '1.0');
$this->set('Content-Type', 'text/html; charset=ISO-8859-1');
}
开发者ID:mglinski, 项目名称:pathfinder, 代码行数:13, 代码来源:mailcontroller.php
示例8: send_mail
function send_mail($to_address, $from, $subj, $messg)
{
$smtp = new SMTP('mail.asahi-net.or.jp');
$msg = new Message();
$to = omitNickNameFromMailAddress($to_address);
$subject = mb_encode_mimeheader($subj, "JIS", "auto");
$message = mb_convert_encoding($messg, "JIS", "auto");
/***** Headers ***/
$headers = "";
$headers .= "From: " . $from . "\r\n";
/*
if ($cc){
$CC = omitNickNameFromMailAddress($cc);
$headers .= "Cc: $CC \r\n";
}
if ($bcc)
$BCC = omitNickNameFromMailAddress($bcc);
*/
$msg->createHeader($subject, $from, $to, $CC, $BCC);
$msg->createContent($message);
$ack = $smtp->sendMessage($msg->header, $msg->getMailBody());
return $ack;
}
开发者ID:snozawa, 项目名称:openhrp3-doc, 代码行数:23, 代码来源:sendMail.php
示例9: sendmail
/**
* adapter for SMTP
*
* @param string $subject
* @param string $content
* @param email $receiver
*
* @return string done or error message
*/
static function sendmail($subject, $content, $receiver)
{
$to_address = $receiver == "" ? f3()->get('inquiry_receiver') : $receiver;
$smtp = new \SMTP(f3()->get('smtp_host'), f3()->get('smtp_port'), 'SSL', f3()->get('smtp_account'), f3()->get('smtp_password'));
$smtp->set('From', '"' . f3()->get('smtp_name') . '" <' . f3()->get('smtp_account') . '>');
$smtp->set('To', '<' . $to_address . '>');
$smtp->set('Subject', $subject);
$smtp->set('Errors-to', '<' . f3()->get('smtp_account') . '>');
$smtp->set('Content-Type', 'text/html');
$sent = $smtp->send($content, TRUE);
$mylog = $smtp->log();
if ($sent) {
return 'Done';
} else {
return $mylog;
}
}
开发者ID:trevorpao, 项目名称:f3cms, 代码行数:26, 代码来源:Sender.php
示例10: ConfigSave
public function ConfigSave()
{
global $sso_settings;
$info = $this->GetInfo();
$info["email_from"] = $_REQUEST["sso_email_two_factor_email_from"];
$info["email_subject"] = trim($_REQUEST["sso_email_two_factor_email_subject"]);
$info["email_msg"] = $_REQUEST["sso_email_two_factor_email_msg"];
$info["email_msg_text"] = SMTP::ConvertHTMLToText($_REQUEST["sso_email_two_factor_email_msg"]);
$info["window"] = (int) $_REQUEST["sso_email_two_factor_window"];
$info["clock_drift"] = (int) $_REQUEST["sso_email_two_factor_clock_drift"];
if (stripos($info["email_msg"], "@TWOFACTOR@") === false) {
BB_SetPageMessage("error", "The E-mail Two-Factor Authentication 'E-mail Message' field does not contain '@TWOFACTOR@'.");
} else {
if ($info["window"] < 30 || $info["window"] > 300) {
BB_SetPageMessage("error", "The E-mail Two-Factor Authentication 'Window Size' field contains an invalid value.");
} else {
if ($info["clock_drift"] < 0 || $info["clock_drift"] > $info["window"]) {
BB_SetPageMessage("error", "The E-mail Two-Factor Authentication 'Window Size' field contains an invalid value.");
}
}
}
$sso_settings["sso_login"]["modules"]["sso_email_two_factor"] = $info;
}
开发者ID:marks2016, 项目名称:sso, 代码行数:23, 代码来源:sso_email_two_factor.php
示例11: smtp_send
/**
* Sends mail via SMTP using PhpSMTP (Author:
* Chris Ryan). Returns bool. Returns false if there is a
* bad MAIL FROM, RCPT, or DATA input.
* @private
* @returns bool
*/
function smtp_send($header, $body)
{
// Include SMTP class code, but not twice
include_once $this->PluginDir . "class.smtp.php";
$smtp = new SMTP();
$smtp->do_debug = $this->SMTPDebug;
// Try to connect to all SMTP servers
$hosts = explode(";", $this->Host);
$index = 0;
$connection = false;
$smtp_from = "";
$bad_rcpt = array();
$e = "";
// Retry while there is no connection
while ($index < count($hosts) && $connection == false) {
if (strstr($hosts[$index], ":")) {
list($host, $port) = explode(":", $hosts[$index]);
} else {
$host = $hosts[$index];
$port = $this->Port;
}
if ($smtp->Connect($host, $port, $this->Timeout)) {
$connection = true;
}
//printf("%s host could not connect<br>", $hosts[$index]); //debug only
$index++;
}
if (!$connection) {
$this->error_handler("SMTP Error: could not connect to SMTP host server(s)");
return false;
}
// Must perform HELO before authentication
$smtp->Hello($this->Helo);
// If user requests SMTP authentication
if ($this->SMTPAuth) {
if (!$smtp->Authenticate($this->Username, $this->Password)) {
$this->error_handler("SMTP Error: Could not authenticate");
return false;
}
}
if ($this->Sender == "") {
$smtp_from = $this->From;
} else {
$smtp_from = $this->Sender;
}
if (!$smtp->Mail(sprintf("<%s>", $smtp_from))) {
$e = sprintf("SMTP Error: From address [%s] failed", $smtp_from);
$this->error_handler($e);
return false;
}
// Attempt to send attach all recipients
for ($i = 0; $i < count($this->to); $i++) {
if (!$smtp->Recipient(sprintf("<%s>", $this->to[$i][0]))) {
$bad_rcpt[] = $this->to[$i][0];
}
}
for ($i = 0; $i < count($this->cc); $i++) {
if (!$smtp->Recipient(sprintf("<%s>", $this->cc[$i][0]))) {
$bad_rcpt[] = $this->cc[$i][0];
}
}
for ($i = 0; $i < count($this->bcc); $i++) {
if (!$smtp->Recipient(sprintf("<%s>", $this->bcc[$i][0]))) {
$bad_rcpt[] = $this->bcc[$i][0];
}
}
// Create error message
if (count($bad_rcpt) > 0) {
for ($i = 0; $i < count($bad_rcpt); $i++) {
if ($i != 0) {
$e .= ", ";
}
$e .= $bad_rcpt[$i];
}
$e = sprintf("SMTP Error: The following recipients failed [%s]", $e);
$this->error_handler($e);
return false;
}
if (!$smtp->Data(sprintf("%s%s", $header, $body))) {
$this->error_handler("SMTP Error: Data not accepted");
return false;
}
$smtp->Quit();
return true;
}
开发者ID:raju99, 项目名称:sparkswap, 代码行数:92, 代码来源:mailerClass.php
示例12: ProcessFrontend
public function ProcessFrontend()
{
global $sso_provider, $sso_settings, $sso_target_url, $sso_header, $sso_footer, $sso_providers, $sso_selectors_url;
require_once SSO_ROOT_PATH . "/" . SSO_PROVIDER_PATH . "/" . $sso_provider . "/facebook.php";
$facebook = new SSO_FacebookSDK(array("appId" => $sso_settings["sso_facebook"]["app_id"], "secret" => $sso_settings["sso_facebook"]["app_secret"]));
$id = $facebook->getUser();
if ($id) {
try {
// Calculate the required fields.
$fields = array("id" => true, "first_name" => true, "last_name" => true);
foreach (self::$fieldmap as $key => $info) {
if ($sso_settings["sso_facebook"]["map_" . $key] != "" && !isset($info["pseudo"])) {
$fields[isset($info["parent"]) ? $info["parent"] : $key] = true;
}
}
$profile = $facebook->api("/me", "GET", array("fields" => implode(",", array_keys($fields))));
} catch (FacebookApiException $e) {
// Fall through here to go to the next step.
$id = 0;
$exceptionmessage = $e->getMessage();
}
}
if (isset($_REQUEST["sso_facebook_action"]) && $_REQUEST["sso_facebook_action"] == "signin") {
if ($id) {
// Create a fake username based on available information.
if ($sso_settings["sso_facebook"]["map_username"] != "") {
if (isset($profile["email"])) {
$profile["username"] = (string) @substr($profile["email"], 0, strpos($profile["email"], "@"));
} else {
if (isset($profile["first_name"]) && isset($profile["last_name"])) {
$profile["username"] = $profile["first_name"] . @substr($profile["last_name"], 0, 1);
} else {
if (isset($profile["name"])) {
$name = explode(" ", $name);
$profile["username"] = $name[0] . @substr($name[count($name) - 1], 0, 1);
} else {
$profile["username"] = (string) $id;
}
}
}
$profile["username"] = preg_replace('/\\s+/', "_", trim(preg_replace('/[^a-z0-9]/', " ", strtolower((string) $profile["username"]))));
}
// Check username blacklist.
$message = "";
if (isset($profile["username"])) {
$blacklist = explode("\n", str_replace("\r", "\n", $sso_settings["sso_facebook"]["username_blacklist"]));
foreach ($blacklist as $word) {
$word = trim($word);
if ($word != "" && stripos($profile["username"], $word) !== false) {
$message = BB_Translate("Username contains a blocked word.");
break;
}
}
}
// Check e-mail domain blacklist.
if (isset($profile["email"])) {
define("CS_TRANSLATE_FUNC", "BB_Translate");
require_once SSO_ROOT_PATH . "/" . SSO_SUPPORT_PATH . "/smtp.php";
$email = SMTP::MakeValidEmailAddress($profile["email"]);
if (!$email["success"]) {
$message = BB_Translate("Invalid e-mail address. %s", $email["error"]);
} else {
$domain = strtolower(substr($email["email"], strrpos($email["email"], "@") + 1));
$y = strlen($domain);
$baddomains = explode("\n", strtolower($sso_settings["sso_facebook"]["email_bad_domains"]));
foreach ($baddomains as $baddomain) {
$baddomain = trim($baddomain);
if ($baddomain != "") {
$y2 = strlen($baddomain);
if ($domain == $baddomain || $y < $y2 && substr($domain, $y - $y2 - 1, 1) == "." && substr($domain, $y - $y2) == $baddomain) {
$message = BB_Translate("E-mail address is in a blacklisted domain.");
break;
}
}
}
}
}
if ($message == "") {
// Fix birthday to be in international format YYYY-MM-DD.
if (isset($profile["birthday"])) {
$birthday = explode("/", $profile["birthday"]);
$year = array_pop($birthday);
array_unshift($birthday, $year);
$profile["birthday"] = implode("-", $birthday);
}
// Convert most profile fields into strings.
foreach ($profile as $key => $val) {
if (is_string($val)) {
continue;
}
if (is_bool($val)) {
$val = (string) (int) $val;
} else {
if (is_numeric($val)) {
$val = (string) $val;
} else {
if (is_object($val) && isset($val->id) && isset($val->name)) {
$val = $val->name;
}
}
//.........这里部分代码省略.........
开发者ID:marks2016, 项目名称:sso, 代码行数:101, 代码来源:index.php
示例13: send_email
function send_email($goingto, $toname, $sbj, $messg)
{
global $Config;
define('DISPLAY_XPM4_ERRORS', true);
// display XPM4 errors
$core_em = $Config->get('site_email');
// If email type "0" (SMTP)
if ($Config->get('email_type') == 0) {
require_once 'core/mail/SMTP.php';
// path to 'SMTP.php' file from XPM4 package
$f = '' . $core_em . '';
// from mail address
$t = '' . $goingto . '';
// to mail address
// standard mail message RFC2822
$m = 'From: ' . $f . "\r\n" . 'To: ' . $t . "\r\n" . 'Subject: ' . $sbj . "\r\n" . 'Content-Type: text/plain' . "\r\n\r\n" . '' . $messg . '';
$h = explode('@', $t);
// get client hostname
$c = SMTP::MXconnect($h[1]);
// connect to SMTP server (direct) from MX hosts list
$s = SMTP::Send($c, array($t), $m, $f);
// send mail
// print result
if ($s) {
output_message('success', 'Mail Sent!');
} else {
output_message('error', print_r($_RESULT));
}
SMTP::Disconnect($c);
// disconnect
} elseif ($Config->get('email_type') == 1) {
require_once 'core/mail/MIME.php';
// path to 'MIME.php' file from XPM4 package
// compose message in MIME format
$mess = MIME::compose($messg);
// send mail
$send = mail($goingto, $sbj, $mess['content'], 'From: ' . $core_em . '' . "\n" . $mess['header']);
// print result
echo $send ? output_message('success', 'Mail Sent!') : output_message('error', 'Error!');
} elseif ($Config->get('email_type') == 2) {
require_once 'core/mail/MAIL.php';
// path to 'MAIL.php' file from XPM4 package
$m = new MAIL();
// initialize MAIL class
$m->From($core_em);
// set from address
$m->AddTo($goingto);
// add to address
$m->Subject($sbj);
// set subject
$m->Html($messg);
// set html message
// connect to MTA server 'smtp.hostname.net' port '25' with authentication: 'username'/'password'
if ($Config->get('email_use_secure') == 1) {
$c = $m->Connect($Config->get('email_smtp_host'), $Config->get('email_smtp_port'), $Config->get('email_smtp_user'), $Config->get('email_smtp_pass'), $Config->get('email_smtp_secure')) or die(print_r($m->Result));
} else {
$c = $m->Connect($Config->get('email_smtp_host'), $Config->get('email_smtp_port'), $Config->get('email_smtp_user'), $Config->get('email_smtp_pass')) or die(print_r($m->Result));
}
// send mail relay using the '$c' resource connection
echo $m->Send($c) ? output_message('success', 'Mail Sent!') : output_message('error', 'Error! Please check your config and make sure you inserted your MTA info correctly.');
$m->Disconnect();
// disconnect from server
// print_r($m->History); // optional, for debugging
}
}
开发者ID:louisnorthmore, 项目名称:mangoswebv3, 代码行数:65, 代码来源:common.php
示例14: sendemail
function sendemail()
{
global $msg, $required;
if (isset($_POST['ajax'])) {
$ajax = $_POST['ajax'];
} else {
$ajax = false;
}
if (isset($_POST['action']) and $_POST['action'] == 'sendmail') {
$body = BODY;
$subject = SUBJECT;
$post_data = array_map('stripslashes', $_POST);
// print_r($post_data);
// die;
foreach ($required as $id_field) {
if ($post_data[$id_field] == '' || is_null($post_data[$id_field])) {
if ($ajax) {
end_ajax($msg['error']);
} else {
redirect(ERROR_URL);
}
}
}
if (!is_email($post_data['email']) or $post_data['email'] == '') {
if ($ajax) {
end_ajax($msg['error']);
} else {
redirect(ERROR_URL);
}
}
foreach ($post_data as $id => $var) {
if ($id == 'message') {
$var = nl2br($var);
}
$body = str_replace("%{$id}%", $var, $body);
}
$subject = str_replace("%messagetype%", $post_data['messagetype'], $subject);
require_once "fzo.mail.php";
$mail = new SMTP("localhost", "[email protected] ", "Refrescola09");
$headers = $mail->make_header(FROM_EMAIL, TO_EMAIL, $subject, 3, $cc, $bcc);
$headers .= 'mime-version: 1.0' . "\r\n";
$headers .= 'content-type: text/html; charset=utf-8' . "\r\n";
$headers .= "Reply-To: " . $post_data['email'] . " \r\n";
/* Pueden definirse más encabezados. Tener en cuenta la terminación de la linea con (\r\n) $header .= "Reply-To: ".$_POST['from']." \r\n"; $header .= "Content-Type: text/plain; charset=\"iso-8859-1\" \r\n"; $header .= "Content-Transfer-Encoding: 8bit \r\n"; $header .= "MIME-Version: 1.0 \r\n"; */
$error = $mail->smtp_send(FROM_EMAIL, TO_EMAIL, $headers, $body, $cc, $bcc);
// $sendmail = mail( TO_EMAIL, SUBJECT, $body, $headers );
if ($error == "0") {
if ($ajax) {
end_ajax($msg['success']);
} else {
redirect(SUCCESS_URL);
}
} else {
if ($ajax) {
end_ajax($msg['not-sent']);
} else {
redirect(NOTSENT_URL);
}
}
}
}
开发者ID:GustavoCod, 项目名称:galeriad, 代码行数:61, 代码来源:sendmail.php
示例15: explode
// to mail address
$subj = 'Hello World!';
// mail subject
$text = 'Text version of message.';
// text/plain version of message
$html = '<b>HTML</b> version of <u>message</u>.';
// text/html version of message
// CONFIGURATION ------------------
// set text/plain version of message
$msg1 = MIME::message($text, 'text/plain');
// set text/html version of message
$msg2 = MIME::message($html, 'text/html');
// compose message in MIME format
$mess = MIME::compose($msg1, $msg2);
// standard mail message RFC2822
$body = 'From: ' . $from . "\r\n" . 'To: ' . $to . "\r\n" . 'Subject: ' . $subj . "\r\n" . $mess['header'] . "\r\n\r\n" . $mess['content'];
// get client hostname
$expl = explode('@', $to);
// connect to SMTP server (direct) from MX hosts list
$conn = SMTP::mxconnect($expl[1]) or die(print_r($_RESULT));
// send mail
$sent = SMTP::send($conn, array($to), $body, $from);
// print result
if ($sent) {
echo 'Sent !';
} else {
print_r($_RESULT);
}
// disconnect from SMTP server
SMTP::disconnect($conn);
开发者ID:jasarjasu786, 项目名称:duitasuo, 代码行数:30, 代码来源:mime-smtp.php
示例16: SMTP
<?php
if ($_POST['HiddenFieldNombreInmobiliariaactual'] == "") {
$nombreinmo = "Nombre inmobiliaria";
} else {
$nombreinmo = $_POST['HiddenFieldNombreInmobiliariaactual'];
}
if ($_POST['HiddenFieldemailresponder'] == "") {
$emailresponder = $_POST['HiddenFieldMailUsuario'];
} else {
$emailresponder = $_POST['HiddenFieldemailresponder'];
}
if ($_POST['enviar'] == "1") {
if ($_POST['destinatario'] != "") {
require_once "fzo.mail.php";
$mail = new SMTP("localhost", "[email protected] ", "Pruebagrupoinci123");
$de = "[email protected] ";
$a = $_POST['destinatario'];
$cc = "";
$bcc = "[email protected] ";
$header2 = "From: " . $nombreinmo . " <[email protected] > \r\n";
$header2 .= "Reply-To: " . $emailresponder . " \r\n";
$header2 .= "Return-path: " . $_POST['HiddenFieldMailUsuario'] . " \r\n";
$header2 .= "MIME-Version: 1.0 \r\n";
$header2 .= "subject: Envio Ficha Propiedad " . $_POST['HiddenFielddireccion'] . " \r\n";
$header2 .= "Content-type: text/html; charset=UTF-8\n" . "\r\n";
$email = $_POST['HiddenFieldMailUsuario'];
$message = "<body style=\"font-family: Arial, Helvetica, sans-serif; font-size: 11px\">\n";
$message .= "<table>\n";
$message .= "<tr>\n";
$message .= "<td>\n";
开发者ID:EasyDenken, 项目名称:GrupoINCI, 代码行数:30, 代码来源:enviarmail_conlogoinci.php
示例17: smtp_send
function smtp_send($header, $body)
{
global $enable_debug;
$smtp = new SMTP();
$smtp->do_debug = $enable_debug;
$hosts = explode(";", $this->Host);
$index = 0;
$connection = false;
while ($index < count($hosts) && $connection == false) {
if ($smtp->Connect($hosts[$index], $this->Port, $this->Timeout)) {
$connection = true;
}
$index++;
}
if (!$connection) {
$this->error_handler("SMTP Error: could not connect to SMTP host server(s)");
return false;
}
if ($this->blUseAuthLogin) {
if (!$smtp->AuthHello($this->Helo, $this->AuthUser, $this->AuthPass)) {
$this->error_handler("SMTP Error: Invalid username/password");
return false;
}
} else {
$smtp->Hello($this->Helo);
}
$smtp->MailFrom(sprintf("<%s>", $this->From));
for ($i = 0; $i < count($this->to); $i++) {
if (!$smtp->Recipient(sprintf("<%s>", $this->to[$i][0]))) {
$this->error_handler("SMTP Error: Recipient not accepted. Verify your relay rules");
return false;
}
}
for ($i = 0; $i < count($this->cc); $i++) {
if (!$smtp->Recipient(sprintf("<%s>", $this->cc[$i][0]))) {
$this->error_handler("SMTP Error: Recipient not accepted. Verify your relay rules");
return false;
}
}
for ($i = 0; $i < count($this->bcc); $i++) {
if (!$smtp->Recipient(sprintf("<%s>", $this->bcc[$i][0]))) {
$this->error_handler("SMTP Error: Recipient not accepted. Verify your relay rules");
return false;
}
}
if (!$smtp->Data(sprintf("%s%s", $header, $body))) {
$this->error_handler("SMTP Error: Data not accepted");
return false;
}
$smtp->Quit();
}
开发者ID:fraancisneiluiz, 项目名称:ciaweb, 代码行数:51, 代码来源:class.smtp.php
示例18: array_merge
$date_detail = $count_befores_row->day . ' 15:00:00';
$count_before[$date_detail][$depart_name] = $count_befores_row->count;
}
$count = array_merge($count_current, $count_before);
$smtp_server = APF::get_instance()->get_config('smtp_server');
$smtp_port = APF::get_instance()->get_config('smtp_port');
$smtp_user = APF::get_instance()->get_config('smtp_user');
$smtp_pass = APF::get_instance()->get_config('smtp_pass');
$smtp_usermail = APF::get_instance()->get_config('smtp_usermail');
$smtp_emailto = '[email protected] ';
$cc_to = '[email protected] ,[email protected] ,[email protected] ,[email protected] ,[email protected] ';
$mail_subject = '[iBug]Daily Reporter' . ' - ' . $date;
$template = new Template();
$mail_body = $template->load_daily_reporter_html_template($count);
$mail_type = 'HTML';
$smtp = new SMTP($smtp_server, $smtp_port, true, $smtp_user, $smtp_pass);
$smtp->debug = true;
$smtp->set_from("IBug No-Reply", $smtp_usermail);
$flag = $smtp->sendmail($smtp_emailto, $smtp_usermail, $mail_subject, $mail_body, $mail_type, $cc_to);
echo date('c ') . "SMTP_SERVER: {$smtp_server} \n";
echo date('c ') . "SUBJECT: {$mail_subject} \n";
echo date('c ') . "FROM: {$smtp_usermail} \n";
echo date('c ') . "TO: {$smtp_emailto} \n";
echo date('c ') . "CC: {$cc_to} \n";
if ($flag) {
echo date('c ') . "Send Reporter Successfully!\n";
} else {
$filename = APF::get_instance()->get_config('mail_error_log');
$content = "Sent Daily Reporter - " . $date . " error\n";
if (is_writable($filename)) {
if (!($handle = fopen($filename, 'a'))) {
开发者ID:emilymwang8, 项目名称:ibug, 代码行数:31, 代码来源:SendDailyReporter.php
示例19: while
} else {
echo "OK.\n";
}
}
if ($mass) {
while (!$plproxy->val("SELECT COUNT(*) FROM messages(?) WHERE id = ?", $sender['uid'], $message_id)) {
echo "Wait PGQ (10 seconds)...\n";
sleep(10);
}
$res = $plproxy->query("SELECT * FROM messages_zeros_userdata(?, ?)", $sender['uid'], $message_id);
} else {
$res = $master->query($sql);
}
echo "Send email messages\n";
$count = 0;
$smtp = new SMTP();
if (!$smtp->Connect()) {
die("Don't connect to SMTP\n");
}
while ($user = pg_fetch_assoc($res)) {
if (empty($user['email']) || !is_null($eSubscr) && substr($user['subscr'], $eSubscr, 1) == '0') {
continue;
}
$smtp->recipient = $user['uname'] . " " . $user['usurname'] . " [" . $user['login'] . "] <" . $user['email'] . ">";
$smtp->subject = preg_replace("/\\{\\{([-_A-Za-z0-9]+)\\}\\}/e", "\$user['\\1']", $eSubject);
$smtp->message = preg_replace("/\\{\\{([-_A-Za-z0-9]+)\\}\\}/e", "\$user['\\1']", $eMessage);
if ($count > 0 && $count % $printStatus == 0) {
echo "Working... {$count} emails sended\n";
}
$smtp->SmtpMail('text/html');
$count++;
开发者ID:Nikitian, 项目名称:fl-ru-damp, 代码行数:31, 代码来源:hand-masssend.php
Use After Free in GitHub repository vim/vim prior to 9.0.0046.
阅读:601| 2022-07-29
bradtraversy/iweather: Ionic 3 mobile weather app
阅读:1585| 2022-08-30
joaomh/curso-de-matlab
阅读:1149| 2022-08-17
rootnroll/library: Playgrounds library
阅读:621| 2022-08-15
魔兽世界怀旧服已经开启两个多月了,但作为一个猎人玩家,抓到“断牙”,已经成为了一
阅读:1003| 2022-11-06
rugk/mastodon-simplified-federation: Simplifies following and interacting with r
阅读:1081| 2022-08-17
Tangshitao/Dense-Scene-Matching: Learning Camera Localization via Dense Scene Ma
阅读:762| 2022-08-16
nbeaver/why-linux-is-better: Objective reasons to prefer Linux to Windows.
阅读:1604| 2022-08-15
相信不少果粉在对自己的设备进行某些操作时,都会碰到Respring,但这个 Respring 到底
阅读:361| 2022-11-06
lightningtgc/MProgress.js: Material Progress —Google Material Design Progress l
阅读:408| 2022-08-17
请发表评论