- android - RelativeLayout 背景可绘制重叠内容
- android - 如何链接 cpufeatures lib 以获取 native android 库?
- java - OnItemClickListener 不起作用,但 OnLongItemClickListener 在自定义 ListView 中起作用
- java - Android 文件转字符串
我是新手,所以请多多包涵。我正在尝试将 BCC 收件人添加到 codeigniter 应用程序的 email.php 配置文件之一。原件是由一名离开我们公司的员工创建的,我正在努力将密件抄送收件人添加到代码中。我搜索了 stackoverflow 并尝试了无穷无尽的变化,但我没有任何运气。我想要做的就是定义一个密件抄送电子邮件收件人。我真的非常感谢任何人的帮助:)
这是我认为相关的当前代码的一部分:
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
/**
* CodeIgniter
*
* An open source application development framework for PHP 5.1.6 or newer
*
* @package CodeIgniter
* @author ExpressionEngine Dev Team
* @copyright Copyright (c) 2008 - 2011, EllisLab, Inc.
* @license http://codeigniter.com/user_guide/license.html
* @link http://codeigniter.com
* @since Version 1.0
* @filesource
*/
// ------------------------------------------------------------------------
/**
* CodeIgniter Email Class
*
* Permits email to be sent using Mail, Sendmail, or SMTP.
*
* @package CodeIgniter
* @subpackage Libraries
* @category Libraries
* @author ExpressionEngine Dev Team
* @link http://codeigniter.com/user_guide/libraries/email.html
*/
class CI_Email {
var $useragent = "CodeIgniter";
var $mailpath = "/usr/sbin/sendmail"; // Sendmail path
var $protocol = "mail"; // mail/sendmail/smtp
var $smtp_host = ""; // SMTP Server. Example: mail.earthlink.net
var $smtp_user = ""; // SMTP Username
var $smtp_pass = ""; // SMTP Password
var $smtp_port = "25"; // SMTP Port
var $smtp_timeout = 5; // SMTP Timeout in seconds
var $smtp_crypto = ""; // SMTP Encryption. Can be null, tls or ssl.
var $wordwrap = TRUE; // TRUE/FALSE Turns word-wrap on/off
var $wrapchars = "76"; // Number of characters to wrap at.
var $mailtype = "text"; // text/html Defines email formatting
var $charset = "utf-8"; // Default char set: iso-8859-1 or us-ascii
var $multipart = "mixed"; // "mixed" (in the body) or "related" (separate)
var $alt_message = ''; // Alternative message for HTML emails
var $validate = FALSE; // TRUE/FALSE. Enables email validation
var $priority = "3"; // Default priority (1 - 5)
var $newline = "\n"; // Default newline. "\r\n" or "\n" (Use "\r\n" to comply with RFC 822)
var $crlf = "\n"; // The RFC 2045 compliant CRLF for quoted-printable is "\r\n". Apparently some servers,
// even on the receiving end think they need to muck with CRLFs, so using "\n", while
// distasteful, is the only thing that seems to work for all environments.
var $send_multipart = TRUE; // TRUE/FALSE - Yahoo does not like multipart alternative, so this is an override. Set to FALSE for Yahoo.
var $bcc_batch_mode = FALSE; // TRUE/FALSE Turns on/off Bcc batch feature
var $bcc_batch_size = 200; // If bcc_batch_mode = TRUE, sets max number of Bccs in each batch
var $_safe_mode = FALSE;
var $_subject = "";
var $_body = "";
var $_finalbody = "";
var $_alt_boundary = "";
var $_atc_boundary = "";
var $_header_str = "";
var $_smtp_connect = "";
var $_encoding = "8bit";
var $_IP = FALSE;
var $_smtp_auth = FALSE;
var $_replyto_flag = FALSE;
var $_debug_msg = array();
var $_recipients = array();
var $_cc_array = array();
var $_bcc_array = array();
var $_headers = array();
var $_attach_name = array();
var $_attach_type = array();
var $_attach_disp = array();
var $_protocols = array('mail', 'sendmail', 'smtp');
var $_base_charsets = array('us-ascii', 'iso-2022-'); // 7-bit charsets (excluding language suffix)
var $_bit_depths = array('7bit', '8bit');
var $_priorities = array('1 (Highest)', '2 (High)', '3 (Normal)', '4 (Low)', '5 (Lowest)');
/**
* Constructor - Sets Email Preferences
*
* The constructor can be passed an array of config values
*/
public function __construct($config = array())
{
if (count($config) > 0)
{
$this->initialize($config);
}
else
{
$this->_smtp_auth = ($this->smtp_user == '' AND $this->smtp_pass == '') ? FALSE : TRUE;
$this->_safe_mode = ((boolean)@ini_get("safe_mode") === FALSE) ? FALSE : TRUE;
}
log_message('debug', "Email Class Initialized");
}
// --------------------------------------------------------------------
/**
* Initialize preferences
*
* @access public
* @param array
* @return void
*/
public function initialize($config = array())
{
foreach ($config as $key => $val)
{
if (isset($this->$key))
{
$method = 'set_'.$key;
if (method_exists($this, $method))
{
$this->$method($val);
}
else
{
$this->$key = $val;
}
}
}
$this->clear();
$this->_smtp_auth = ($this->smtp_user == '' AND $this->smtp_pass == '') ? FALSE : TRUE;
$this->_safe_mode = ((boolean)@ini_get("safe_mode") === FALSE) ? FALSE : TRUE;
return $this;
}
// --------------------------------------------------------------------
/**
* Initialize the Email Data
*
* @access public
* @return void
*/
public function clear($clear_attachments = FALSE)
{
$this->_subject = "";
$this->_body = "";
$this->_finalbody = "";
$this->_header_str = "";
$this->_replyto_flag = FALSE;
$this->_recipients = array();
$this->_cc_array = array();
$this->_bcc_array = array();
$this->_headers = array();
$this->_debug_msg = array();
$this->_set_header('User-Agent', $this->useragent);
$this->_set_header('Date', $this->_set_date());
if ($clear_attachments !== FALSE)
{
$this->_attach_name = array();
$this->_attach_type = array();
$this->_attach_disp = array();
}
return $this;
}
// --------------------------------------------------------------------
/**
* Set FROM
*
* @access public
* @param string
* @param string
* @return void
*/
public function from($from, $name = '')
{
if (preg_match( '/\<(.*)\>/', $from, $match))
{
$from = $match['1'];
}
if ($this->validate)
{
$this->validate_email($this->_str_to_array($from));
}
// prepare the display name
if ($name != '')
{
// only use Q encoding if there are characters that would require it
if ( ! preg_match('/[\200-\377]/', $name))
{
// add slashes for non-printing characters, slashes, and double quotes, and surround it in double quotes
$name = '"'.addcslashes($name, "\0..\37\177'\"\\").'"';
}
else
{
$name = $this->_prep_q_encoding($name, TRUE);
}
}
$this->_set_header('From', $name.' <'.$from.'>');
$this->_set_header('Return-Path', '<'.$from.'>');
return $this;
}
// --------------------------------------------------------------------
/**
* Set Reply-to
*
* @access public
* @param string
* @param string
* @return void
*/
public function reply_to($replyto, $name = '')
{
if (preg_match( '/\<(.*)\>/', $replyto, $match))
{
$replyto = $match['1'];
}
if ($this->validate)
{
$this->validate_email($this->_str_to_array($replyto));
}
if ($name == '')
{
$name = $replyto;
}
if (strncmp($name, '"', 1) != 0)
{
$name = '"'.$name.'"';
}
$this->_set_header('Reply-To', $name.' <'.$replyto.'>');
$this->_replyto_flag = TRUE;
return $this;
}
// --------------------------------------------------------------------
/**
* Set Recipients
*
* @access public
* @param string
* @return void
*/
public function to($to)
{
$to = $this->_str_to_array($to);
$to = $this->clean_email($to);
if ($this->validate)
{
$this->validate_email($to);
}
if ($this->_get_protocol() != 'mail')
{
$this->_set_header('To', implode(", ", $to));
}
switch ($this->_get_protocol())
{
case 'smtp' :
$this->_recipients = $to;
break;
case 'sendmail' :
case 'mail' :
$this->_recipients = implode(", ", $to);
break;
}
return $this;
}
// --------------------------------------------------------------------
/**
* Set CC
*
* @access public
* @param string
* @return void
*/
public function cc($cc)
{
$cc = $this->_str_to_array($cc);
$cc = $this->clean_email($cc);
if ($this->validate)
{
$this->validate_email($cc);
}
$this->_set_header('Cc', implode(", ", $cc));
if ($this->_get_protocol() == "smtp")
{
$this->_cc_array = $cc;
}
return $this;
}
// --------------------------------------------------------------------
/**
* Set BCC
*
* @access public
* @param string
* @param string
* @return void
*/
public function bcc($bcc, $limit = '')
{
if ($limit != '' && is_numeric($limit))
{
$this->bcc_batch_mode = TRUE;
$this->bcc_batch_size = $limit;
}
$bcc = $this->_str_to_array($bcc);
$bcc = $this->clean_email($bcc);
if ($this->validate)
{
$this->validate_email($bcc);
}
if (($this->_get_protocol() == "smtp") OR ($this->bcc_batch_mode && count($bcc) > $this->bcc_batch_size))
{
$this->_bcc_array = $bcc;
}
else
{
$this->_set_header('Bcc', implode(", ", $bcc));
}
return $this;
}
// --------------------------------------------------------------------
最佳答案
您能否在您的任何 Controller 索引函数中尝试下面的代码并运行它。
$this->load->library('email');
$this->email->from('your@example.com', 'Your Name');
$this->email->to('someone@example.com');
$this->email->cc('another@another-example.com');
$this->email->bcc('them@their-example.com');
$this->email->subject('Email Test');
$this->email->message('Testing the email class.');
$this->email->send();
echo $this->email->print_debugger();
关于php - Codeigniter 电子邮件 - 添加 BCC,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43810853/
我在我的 Rails 应用程序中使用 Sendgrid,当我在 TO 和 BCC 中添加电子邮件时,然后在通过我的应用程序发送电子邮件后,TO 电子邮件工作正常并且我收到了电子邮件,但是当我使用相同的
昨天,我和我的 friend 设置了我们的开发环境,开始处理一项学校作业。我们的教授给了我们一些汇编代码来编译和链接我们自己的 C 代码以替换 linux Bootstrap 。然而,出于某种原因,代
我正在尝试使用电子邮件命令向收件人发送电子邮件并密件抄送另外两个地址。问题是“-b”标志没有被读取为尝试将电子邮件发送到“-b person@example.com”的引导邮件。该命令如下所示。 ma
我有一个以编程方式生成和发送电子邮件的应用程序。收件人列表可以达到 1000 个以上。我一直在循环查看并发送单独的电子邮件,但是每封邮件大约需要 0.5 秒,这花费的时间太长了。我现在正在研究的方法是
我知道有几个与此类似的问题,但我无法让它正常工作。 好的,我在一个名为 $emailList 的变量中有一个从我的数据库中获取的电子邮件列表。如果我将变量放在 $to 部分,我可以让我的代码从表单发送
我正在使用 PHPMailer 从我的脚本中通过 SMTP 发送电子邮件。有问题的电子邮件实际上是使用电子邮件到 SMS 网关的手机号码。现在,理想情况下,我想建立一个大的密件抄送列表,以一批发送所有
当有人在 woocommerce 中下订单时,您会以管理员身份收到订单的电子邮件。我想为此电子邮件添加其他收件人。然而!我只想在这些确切的邮件上制作这个额外的密件抄送。并非所有其他邮件都会通过。 此线
我正在尝试创建一个简单的 python 程序来发送电子邮件。这是相关的代码行。我希望使用“收件人”字段发送电子邮件。当我运行该程序并检查测试电子邮件帐户时,该程序似乎是通过密件抄送发送的。 以下是相关
我想知道任何人都可以在这方面提供帮助。 我有这个可以发送电子邮件的 python 代码。 import smtplib import string import sys import os froma
我广泛听说 Borland C++ 5.5 编译器是免费提供的。搜索下载链接通常只会将我带到 embarcadero.com 页面,如果我能弄清楚,我该死的...... 有人知道下载 BCC 5.5
php 邮件函数的第一个参数是 TO。有没有办法跳过这个参数,只使用抄送/密件抄送来群发邮件? 谢谢 最佳答案 安email message does not require a To header
不会收到 BCC/CC(在标题中)中指定的收件人。我发现有几个帖子有类似的问题,没有答案...... 代码如下,问题是:“你们有遇到过类似的问题吗?” require_once "Mail.php";
bcc使用python编译ebpf程序,有什么方便的方法可以将这些python脚本生成可执行文件,以便我可以在没有安装clang和llvm环境的服务器上运行这些跟踪程序? 最佳答案 TL;DR. 不,
我已经为基于 codeigniter 的项目设置了 Amazon SES,但似乎所有密件抄送电子邮件都没有送达..,我在亚马逊提供的 perl 脚本上进行了测试,密件抄送电子邮件也没有收到。 有人在使
将多个收件人添加到 MailMessage.BCC 时,AddRange() 没有选项。只有 MailMessage.Bcc.Add(); 可以通过扩展方法更改此功能吗?在这一点上我有点迷茫,任何指点
我正在通过 .NET 的 SerialPort 类通过串行方式与设备通信,并且根据第三方设备规范要求,我需要计算“ block 检查字符”。我得到的唯一信息是它是一个异或运算 (XOR),必须对所有字
我已经测试了以下代码几个小时。电子邮件将发送到通过 $mail->AddAddress() 添加的地址,并且在收到的电子邮件中它指出抄送但抄送的人没有收到电子邮件。我到处都看过,找不到解决为什么会这样
我是新手,所以请多多包涵。我正在尝试将 BCC 收件人添加到 codeigniter 应用程序的 email.php 配置文件之一。原件是由一名离开我们公司的员工创建的,我正在努力将密件抄送收件人添加
我从网站上复制了 PEAR 邮件的代码,并输入了我的数据。有用。它发送邮件,但是,我想使用 bcc 发送给很多人并保持他们的地址匿名,它会发送给 $to 收件人,而不是 $bcc。 代码: $fro
这个程序正在运行,但是如何发送多个CC和BCC。 for($i = 0; $i \r\n"; $headers .= "Reply-To: \r\n"; $hedders .= "c
我是一名优秀的程序员,十分优秀!