jjzjj

php - 发送 CodeIgniter 奇怪的电子邮件

coder 2024-05-03 原文

我有一个函数,我可以传递参数来轻松发送电子邮件。

就是这样:

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/

有关php - 发送 CodeIgniter 奇怪的电子邮件的更多相关文章

  1. c# - 如何删除作为 HttpResponseMessage 的 StreamContent 发送的文件 - 2

    在ASP.NETwebapi中,我向客户端发送了一个临时文件。我打开一个流来读取文件并在HttpResponseMessage上使用StreamContent。客户端收到文件后,我想删除这个临时文件(没有来自客户端的任何其他调用)客户端收到文件后,将调用HttpResponseMessage的Dispose方法,并且流也会被释放。现在,此时我也想删除临时文件。一种方法是从HttpResponseMessage类派生一个类,覆盖Dispose方法,删除此文件并调用基类的dispose方法。(我还没有尝试过,所以不确定这是否有效)我想知道是否有更好的方法来实现这一点。

  2. c# - 限制访问,直到用户确认电子邮件链接 - 2

    我正在玩Identity.Samples示例,发现用户在注册后仍然可以登录,而无需单击电子邮件确认。是否有一个标志可以打开以限制用户在他/她单击他/她的电子邮件中的确认链接之前登录?或者我需要编写任何额外的代码来防止这种情况发生?编辑:添加示例中的登录操作代码[HttpPost][AllowAnonymous][ValidateAntiForgeryToken]publicasyncTask<ActionResult>Login(LoginViewModelmodel,stringreturnUrl){if(!ModelState.IsValid){returnView(m

  3. C# 简单事件引发 - 使用 "sender"与自定义 EventArgs - 2

    考虑这个场景。我有一个对象,我们称它为....Foo。Foo引发了一个名为“Loaded”的简单事件。作为事件信息的一部分,消费者需要知道哪个foo对象引发了事件。我们的团队采用了以下模式。1)创建一个继承自EventArgs的新类-例如,FooEventArgs:System.EventArgs.2)在FooEventArgs中添加一个Foo类型的属性,通过构造函数传入来设置。3)使用通用版本的EventHandler声明事件,所以publiceventEventHandler<FooEventArgs>Loaded;4)从具有以下签名的Foo类引发事件:Loaded(t

  4. c# - ASP.NET 标识使用电子邮件而不是用户名 - 2

    这个问题在这里已经有了答案:ASP.NetUserNametoEmail(7个答案)关闭6年前。如何在新的ASP.NET身份系统中使用电子邮件而不是用户名?我试图更改RegisterViewModel类:[Display(Name="Emailaddress")][Required(ErrorMessage="Theemailaddressisrequired")][EmailAddress(ErrorMessage="InvalidEmailAddress")]publicstringUserName{get;set;}但是当我输入邮件

  5. c# - 如何使用 System.Net.Mail 向电子邮件添加附件? - 2

    我有一个用byte[]表示的excel文档,我想将它作为电子邮件的附件发送。我在构建附件时遇到了一些麻烦。我可以创建一个具有以下构造函数的附件:(StreamcontentStream,ContentTypecontentType)(StreamcontentStream,stringname)(StreamcontentStream,stringname,stringmediaType)我目前的想法是从byte[]创建一个MemoryStream并将其传递给创建附件的方法。不幸的是,我看不到从MemoryStream中获取预期文件名和内容类型的方法,而且我也看不到如何提供正确的内容类

  6. c# - 尽管在响应对象上配置了缓存控制 header ,但未在响应中发送 - 2

    我试图在ASP.NETMVCWebAPI中设置缓存header,但IIS的响应表明CacheControl值集被忽略了。我最初的假设是我在System.Web.Http.Cors中使用了EnableCorsAttribute,这在这个用例中是必需的。但是,即使没有该属性,响应Cache-Controlheader仍然是“私有(private)的”。我这里有什么地方做错了吗?//GETapi/<version>/content//[EnableCors(origins:"*",headers:"*",methods:"*")]p

  7. c# - 哪些阻塞操作会导致 STA 线程发送 COM 消息? - 2

    当COM对象在STA线程上实例化时,该线程通常必须实现消息泵以编码来回其他线程的调用(请参阅here)。可以手动发送消息,也可以依靠一些但不是全部线程阻塞操作在等待时自动发送与COM相关的消息这一事实。文档通常无助于决定哪个是哪个(参见thisrelatedquestion)。如何确定线程阻塞操作是否会在STA上发送COM消息?到目前为止的部分列表:阻止做泵*的操作:Thread.JoinWaitHandle.WaitOne/WaitAny/WaitAll(虽然不能从STA线程调用WaitAll)GC.WaitForPendingFinalizersMonitor.Enter(因此lo

  8. c# - 你能用可选参数解释一下 c# 的这种奇怪行为吗? - 2

    这个问题在这里已经有了答案:关闭10年前。PossibleDuplicate:C#optionalparametersonoverriddenmethods这是以下代码的输出:Peter:-1Peter:0Fred:1Fred:1你能解释一下为什么Peterp.TellYourAge()和p.DoSomething()的调用不一样吗?这里是您自己尝试的代码(VS2010和FW4):staticvoidMain(string[]args){Peterp=newPeter();p.TellYourAge();//expected-1,result:-1p.DoSomething();//e

  9. c# - 服务器无法在发送上传文件的 HTTP header 后附加 header - 2

    我在我的asp.netmvc5c#web应用程序中间歇性地遇到这个异常:ServercannotappendheaderafterHTTPheadershavebeensent.它只是碰巧将图像上传到S3方法(WebApiController)。Global.asax中的presendrequestheadersprotectedvoidApplication_PreSendRequestHeaders(objectsender,EventArgse){HttpApplicationapp=senderasHttpApplication;if(app!=null&&ap

  10. c# - 移植时出现 Mono resources.resx 问题( '</data>' 上的 resx xml 文件出现奇怪错误) - 2

    所以我有一个C#应用程序。它有一些链接到它的Assets,并在编译时被嵌入。应用程序在Windows上完美编译和运行。当测试与单声道的兼容性时,一切都是正确的。如果我尝试编译给出一个错误nxml文件/home/rupert/Desktop/CloudObserverLite(4)/CloudObserverLite/Properties/Resources.resx:Error:Error:InvalidResXinput.Position:Line123,Column5.Innerexception:value(CloudObserverLite)如果我们将查看resxxml...&

随机推荐

  1. c# - 如何获取DevExpress XtraGrid选中的行值? - 2

    考虑下图当我使用以下代码单击一个单元格时,我在图中显示的三个文本框中获得了选定的行值。voiddataGridView1_CellClick_1(objectsender,DataGridViewCellEventArgse){TBGRNo.Text=dataGridView1.Rows[e.RowIndex].Cells[0].Value.ToString();TBSName.Text=dataGridView1.Rows[e.RowIndex].Cells[1].Value.ToString();TBFName.Text=dataGridView1.Rows[e.RowIndex]

  2. c# - 如何将变量传递给按钮事件方法? - 2

    我需要能够将两个对象传递给单击按钮时触发的方法。我该怎么做?到目前为止,我一直在考虑创建一个更改的EventArgs:publicclassCompArgs:System.EventArgs{privateobjectmetode;privateTypetypen;publicCompArgs(objectm,Typet){this.metode=m;this.typen=t;}publicobjectMetode(){returnmetode;}publicTypeTypen(){returntypen;}}但是我该如何使用它呢?是否有可能以某种方式覆盖按钮的点击事件以使用自定义ev

  3. c# - 无法使用 C# ConfigurationManager - 2

    我有以下代码:usingSystem.Configuration;namespacetest{publicpartialclassMyService:ServiceBase{publicstaticReadConnectionStrings(){ConnectionStringSettingsCollectionconnections=ConfigurationManager.ConnectionStrings;但是,它不识别ConfigurationManager。我直接从here中获取了这段代码所以我显然遗漏了什么,但无法确定是什么。 最佳答案

  4. c# - 将参数传递给事件处理程序 - 2

    这个问题在这里已经有了答案:Passextraparameterstoaneventhandler?(10个答案)关闭9年前。我想通过我的List<string>作为参数使用我的事件publiceventEventHandler_newFileEventHandler;List<string>_filesList=newList<string>();publicvoidstartListener(stringdirectoryPath){FileSystemWatcherwatcher=newFileSystemWatcher(directoryPa

  5. c# - 将数据 GridView 导出到 csv 文件 - 2

    我正在开发一个应用程序,该应用程序会将名为scannerDataGridView的DataGridView导出到csv文件。找到了一些示例代码来执行此操作,但无法使其正常工作。顺便说一句,我的数据网格没有数据绑定(bind)到源。当我尝试使用Streamwriter仅写入列标题时,一切顺利,但当我尝试导出包括数据在内的整个数据网格时,我得到了一个异常trhown。System.NullReferenceException:Objectreferencenotsettoaninstanceofanobject.atScanmonitor.Form1.button1_Click(Objec

  6. c# - 在 Windows Phone 中打开纯数字键盘? - 2

    如何设置键盘以数字模式打开或直接打开一个特殊的数字键盘(如在android中)???我的目标是避免用户在输入可能只是数值的值之前每次都按下小按钮来切换字母和数字。我有一个用户需要编辑的文本框。谢谢!!!! 最佳答案 将InputScope设置为Number。XAML<TextBoxInputScope="Number"Name="txtPhoneNumber"/>C#InputScopescope=newInputScope();InputScopeNamename=newInputSco

  7. c# - 比较 DateTime 结构以查找空闲槽 - 2

    我想搜索列表中所有用户的事件,并检索每个用户在早上7点到晚上7点之间有30分钟或更长时间空闲的所有时间。但是有一个问题,如果方法被标记为“重复”,即重复位设置为1,则该事件在开始后的52周内重复发生(因此时间不可用)。这些事件的检索在存储过程中进行处理。到目前为止,我的代码如下。我打算以正确的方式编写此程序吗?我不太确定如何继续让函数返回我想要的。有人能帮我解决这个问题吗?List<string>usernames=//Listofusernames.DateTimestart=//DateTimeforstartofperiodyouwouldliketoschedule

  8. c# - 计算C#中的单词数 - 2

    我正在尝试计算C#中富文本框的字数,我下面的代码只有在单行时才有效。如何在不依赖正则表达式或任何其他特殊功能的情况下执行此操作。stringwhole_text=richTextBox1.Text;stringtrimmed_text=whole_text.Trim();string[]split_text=trimmed_text.Split('');intspace_count=0;stringnew_text="";foreach(stringavinsplit_text){if(av==""){space_count++;}els

  9. c# - List.Sort(自定义排序...) - 2

    我有一个包含3个项目的List对象:Partial、FullToH和FullToO。我将此列表绑定(bind)到aspOptionButtonList,并按字母顺序对其进行排序。但是,我想按如下方式对列表进行排序:全到H,部分,全到O。我怎样才能做到这一点? 最佳答案 Linq对此非常有用。您甚至可以构建顺序序列以动态定义它,因为直到ToList才执行排序。varsortedList=yourList.OrderBy(i=>i.FullToH).ThenBy(i=>i.Partial).ThenBy(i=>i.Fu

  10. c# - 是否可以使用 .net 类型声明别名? - 2

    是否可以声明一个.net类型的别名?在C#中,如果是的话如何? 最佳答案 正如其他人所说,使用“usingalias=type;”using指令的形式。一些事情:1)它必须是文件或命名空间中的第一件事。(当然,除非您有externalias指令;它们位于using指令之前。)2)别名不是真正的类型。很多人希望看到:usingPopsicleCount=System.Int32;usingGiraffeCount=System.Int32;...PopsicleCountp=123;GiraffeCountg=p;//ERROR,ca