我有一个函数,我可以传递参数来轻松发送电子邮件。
就是这样:
function __construct() {
$this -> CI = get_instance();
$this -> CI -> load -> library('email');
}
public function send_one_email($single_email, $single_subject, $single_body, $single_attach) {
$this -> CI -> email -> clear();
$this -> CI -> email -> to($single_email);
$this -> CI -> email -> from('**************');
$this -> CI -> email -> subject($single_subject);
$this -> CI -> email -> message($single_body);
if ($single_attach) {
$this -> CI -> email -> attachment($single_attach);
}
if ($this -> CI -> email -> send()) {
return TRUE;
}
}
我收到的电子邮件是(我不应该收到的):
?= =?utf-8?Q?2013?= Reply-To: "SUNYOrangeScholarInterface@gmail.com" X-Sender: SUNYOrangeScholarInterface@gmail.com X-Mailer: CodeIgniter X-Priority: 3 (Normal) Message-ID: <520eb8d943533@gmail.com> Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="B_ALT_520eb8d943598"
This is a multi-part message in MIME format. Your email application may not support this format.
--B_ALT_520eb8d943598 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit
Hello Rixhers Ajazi this is an automated email to notify you that your account has been successfully created.You must wait for your account to be verified meaning that you do not have access to use ScholarInterface. Once your account is activated and you are given a user role you will be notified via email.Please be advised that since you have created your account you are responsible for keeping your credentials safe. These include your email account, your answers to your security questions, and your password itself.I (Rixhers Ajazi) just want to warn you that if you do not keep your security answers safe then some one can take over your account.Any questions what so ever with ScholarInterface please email Rixhers Ajazi at CoderRix@gmail.comAny questions pertaining to your account please notify your Administrators. Rixhers Ajazi is not a Administrator but a Super User (the coder of this program).
--B_ALT_520eb8d943598 Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: quoted-printable
Hello Rixhers Ajazi this is an automated email to notify you that your acco= unt has been successfully created.You must wait for your account to be veri= fied meaning that you do not have access to use ScholarInterface. On= ce your account is activated and you are given a user role you will be noti= fied via email.Please be advised that since you have created your account y= ou are responsible for keeping your credentials safe. These include your em= ail account, your answers to your security questions, and your password its= elf.I (Rixhers Ajazi) just want to warn you that if you do not keep your se= curity answers safe then some one can take over your account.Any questions = what so ever with ScholarInterface please email Rixhers Ajazi at Cod= erRix@gmail.comAny questions pertaining to your account please notify your = Administrators. Rixhers Ajazi is not a Administrator but a Super User (the = coder of this program).
--B_ALT_520eb8d943598--
这是什么鬼?
这是我在 email.php 中的配置:
if ( ! defined('BASEPATH')) exit('No direct script access allowed');
$config['protocol'] = 'smtp';
$config['smtp_host'] = 'ssl://smtp.googlemail.com';
$config['smtp_user'] = '********************@gmail.com';
$config['smtp_pass'] = '**************************';
$config['smtp_port'] = 465;
$config['smtp_timeout'] = 30;
$config['charset'] = 'utf-8';
$config['crlf'] = "\r\n";
$config['newline'] = "\r\n";
$config['wordwrap'] = TRUE;
$config['mailtype'] = 'html';
我在另一个应用程序中使用了相同的脚本,但我从来没有得到过这个。任何帮助都会很棒。
最佳答案
电子邮件顶部的消息似乎是从主题标题开始的,所以我猜这是开始调试的好地方。
曾经有一个issue caused by Subject lines with more than 75 chars .
如果上述修复不起作用,则开发人员已修补 Email.php 以解决问题:
https://github.com/EllisLab/CodeIgniter/issues/1409#issuecomment-9330713
关于php - 发送 CodeIgniter 奇怪的电子邮件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18283661/
rails中是否有任何规定允许站点的所有AJAXPOST请求在没有authenticity_token的情况下通过?我有一个调用Controller方法的JqueryPOSTajax调用,但我没有在其中放置任何真实性代码,但调用成功。我的ApplicationController确实有'request_forgery_protection'并且我已经改变了config.action_controller.consider_all_requests_local在我的environments/development.rb中为false我还搜索了我的代码以确保我没有重载ajaxSend来发送
我的工作要求我为某些测试自动生成电子邮件。我一直在四处寻找,但未能找到可以快速实现的合理解决方案。它需要在outlook而不是其他邮件服务器中,因为我们有一些奇怪的身份验证规则,我们需要保存草稿而不是仅仅发送邮件的选项。显然win32ole可以做到这一点,但我找不到任何相当简单的例子。 最佳答案 假设存储了Outlook凭据并且您设置为自动登录到Outlook,WIN32OLE可以很好地完成此操作:require'win32ole'outlook=WIN32OLE.new('Outlook.Application')message=
s=Socket.new(Socket::AF_INET,Socket::SOCK_STREAM,0)s.connect(Socket.pack_sockaddr_in('port','hostname'))ssl=OpenSSL::SSL::SSLSocket.new(s,sslcert)ssl.connect从这里开始,如果ssl连接和底层套接字仍然是ESTABLISHED,或者它是否在默认值7200之后进入CLOSE_WAIT,我想检查一个线程几秒钟甚至更糟的是在实际上不需要.write()或.read()的情况下关闭。是用select()、IO.select()还是其他方法完成
我想验证一个电子邮件地址是否是PayPal用户。是否有API调用来执行此操作?是否有执行此操作的ruby库?谢谢 最佳答案 GetVerifiedStatus来自PayPal'sAdaptiveAccounts平台会为您做这件事。PayPal没有任何codesamples或SDKs用于Ruby中的自适应帐户,但我确实找到了编写codeforGetVerifiedStatusinRuby的人.您需要更改该代码以检查他们拥有的帐户类型的唯一更改是更改if@xml['accountStatus']!=nilaccount_status
有没有人用ruby解决这个问题:假设我们有:a=8.1999999我们想将它四舍五入为2位小数,即8.20,然后乘以1,000,000得到8,200,000我们是这样做的;(a.round(2)*1000000).to_i但是我们得到的是8199999,为什么?奇怪的是,如果我们乘以1000、100000或10000000而不是1000000,我们会得到正确的结果。有人知道为什么吗?我们正在使用ruby1.9.2并尝试使用1.9.3。谢谢! 最佳答案 每当你在计算中得到时髦的数字时使用bigdecimalrequire'bi
我想知道我应该如何着手这个项目。我需要每周向人们发送一次电子邮件。但是,这必须在每周的特定时间自动生成并发送。编码有多难?我需要知道是否有任何书籍可以提供帮助,或者你们中的任何人是否可以指导我。它必须使用rubyonrails进行编程。因此有一个网络服务和数据库集成。干杯 最佳答案 为什么这么复杂?您只需安排工作。您可以使用Delayed::Job例如。Delayed::Job让您可以使用run_at符号在特定时间安排作业,如下所示:Delayed::Job.enqueue(SendEmailJob.new(...),:run_
我很难理解Ruby中sender和receiver的实际含义。它们一般是什么意思?到目前为止,我只是将它们理解为方法调用和获取其返回值的调用。但是,我知道我的理解还远远不够。谁能给我一个Ruby中发送者和接收者的具体解释? 最佳答案 面向对象中的一个核心概念是消息传递和早期概念化,这在很大程度上借鉴了计算的Actor模型。艾伦·凯(AlanKay)创造了面向对象一词并发明了最早的OO语言之一SmallTalk,他拥有voicedregretatusingatermwhichputthefocusonobjectsinsteadofo
假设我们有A、B、C类。Adefself.inherited(sub)#metaprogramminggoeshere#takeclassthathasjustinheritedclassA#andforfooclassesinjectprepare_foo()as#firstlineofmethodthenrunrestofthecodeenddefprepare_foo#=>prepare_foo()neededhere#somecodeendendBprepare_foo()neededhere#somecodeendend如您所见,我正在尝试将foo_prepare()调用注入
如果我必须在一个HTTP请求中发送一堆post参数,所有这些参数都具有相同的名称,我该如何构建要发布的data对象?想象一个带有一些复选框的表单,它们都具有相同的name属性但具有不同的值(如果它们被选中):我想用ruby构建它(但它需要根据在表单上选择的内容动态创建):data={"color"=>"red","color"=>"green","color"=>"blue"}然后将数据发送到某个URL:Net::HTTP.post_form(url,data)我无法控制接收端,所以我必须发送它期望接收的参数。怎么办? 最佳答案
defreverse(ary)result=[]forresult[0,0]inaryendresultendassert_equal["baz","bar","foo"],reverse(["foo","bar","baz"])这行得通,我想了解原因。有什么解释吗? 最佳答案 如果我使用each而不是for/in重写它,它看起来像这样:defreverse(ary)result=[]#forresult[0,0]inaryary.eachdo|item|result[0,0]=itemendresultendforainb基本上就