smtp

TP 通过STMP发送Email邮件

蓝咒 提交于 2019-12-03 22:50:11
1.下载PHPMailer文件,把文件放入ThinkPHP目录下的Vendor文件夹内 2.在项目的Common的function文件内写入公共函数 function SendMail ( $to , $title , $content ) { Vendor( 'PHPMailer.phpmailer' ) ; $mail = new PHPMailer() ; // 设置使用 SMTP 服务器发送邮件 $mail -> IsSMTP () ; // 启用 SMTP $mail -> Host = C( 'MAIL_HOST' ) ; //smtp 服务器的名称(这里以 QQ 邮箱为例) $mail -> SMTPAuth = C( 'MAIL_SMTPAUTH' ) ; // 启用 smtp 认证 $mail -> Username = C( 'MAIL_USERNAME' ) ; // 你的邮箱名 $mail -> Password = C( 'MAIL_PASSWORD' ) ; // 邮箱密码 $mail -> From = C( 'MAIL_FROM' ) ; // 发件人地址(也就是你的邮箱地址) $mail -> FromName = C( 'MAIL_FROMNAME' ) ; // 发件人姓名 $mail -> AddAddress ( $to , " 尊敬的客户

TP框架实现发送邮件

…衆ロ難τιáo~ 提交于 2019-12-03 22:49:36
1.在模块的配置文件config中加入下里面代码 'THINK_EMAIL' => array( 'SMTP_HOST' => 'SMTP.163.com', //SMTP服务器 'SMTP_PORT' => '465', //SMTP服务器端口 'SMTP_USER' => '156******83@163.com', //SMTP服务器用户名 'SMTP_PASS' => '********', //SMTP服务器密码 'FROM_EMAIL' => '156******83@163.com', //发件人EMAIL 'FROM_NAME' => 'demo', //发件人名称 'REPLY_EMAIL' => '', //回复EMAIL(留空则为发件人EMAIL) 'REPLY_NAME' => '', //回复名称(留空则为发件人名称) ), 2.在Common目录下创建function.php文件,加入下面代码 function think_send_mail($to, $name, $subject = '', $body = '', $attachment = null){ $config = C('THINK_EMAIL'); vendor('PHPMailer.class#phpmailer'); //从PHPMailer目录导class.phpmailer

TP5实现发送邮件服务的封装和调用

十年热恋 提交于 2019-12-03 22:48:21
在此之前,需要说明一下,我采用的是SMTP的邮件服务,因为在测试这个功能的时候 需要给发件邮箱开通SMTP服务 以我的邮箱是126网易邮箱为例 注册一个邮箱之后 https://www.126.com/ 登陆之后点击设置 找到对应的服务 进入之后进行勾选开启服务 授权码自己设置 然后也可以看到SMTP对应的服务器地址 后面会用到的 配置之后 记住授权码! 就可以了 然后引入phpmailer的类库文件,放到TP5目录下的extend目录下 如图 类库文件可以在我的资源进行获取 (是自己拿到的开源代码之后 进行部分修改之后 融入到这套框架中) 获取地址: https://download.csdn.net/download/zhangzeshan/11259051 引入之后说明一些东西: 这个源文件中的pop3被我删掉了 因为暂时没有用到 然后Email.php是我新建的 自行封装的类( 代码也在资源中) 现在看下代码 封装了这个函数 是让我们进行调用的 调用的时候 需要传三个参数 注释上写好了 然后这块代码的config的配置我也说名义下 地址在:application\extra\email.php 里面内容的就是smtp服务器地址 端口号 发件的邮箱 发件邮箱的授权码 配置完之后 接下来演示一下如何调用 我直接在后台index控制器新建一个方法

Rails EOFError (end of file reached) when saving a devise user

心不动则不痛 提交于 2019-12-03 22:36:33
I'm getting this error in production when trying to create a user (i'm using the devise gem). EOFError (end of file reached): I hit this problem before and it was due to my smtp settings using zoho mail. I believe my configuration below is what fixed the problem: ActionMailer::Base.delivery_method = :smtp ActionMailer::Base.smtp_settings = { :address => "smtp.zoho.com", :port => 465, :domain => 'example.com', :user_name => 'user@example.com', :password => 'password', :authentication => :login, :ssl => true, :tls => true, :enable_starttls_auto => true } Now we've added SSL to the site and I

Is SMTP based on TCP or UDP?

 ̄綄美尐妖づ 提交于 2019-12-03 22:07:28
Is SMTP based on TCP or UDP ? I really can't confirm it . In my opinion, SMTP should be based on UDP, but someone told me that is must be TCP. In theory SMTP can be handled by either TCP, UDP, or some 3rd party protocol. As defined in RFC 821 , RFC 2821 , and RFC 5321 : SMTP is independent of the particular transmission subsystem and requires only a reliable ordered data stream channel. In addition, the Internet Assigned Numbers Authority has allocated port 25 for both TCP and UDP for use by SMTP. In practice however, most if not all organizations and applications only choose to implement the

Cant emails through exchange: An existing connection was forcibly closed by the remote host

[亡魂溺海] 提交于 2019-12-03 21:13:49
I just noticed that some of the email operations in my code have been failing and am trying to fix it up, however I keep getting the following error: System.Net.Mail.SmtpException: Failure sending mail. ---> System.IO.IOException: Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host. ---> System.Net.Sockets.SocketException: An existing connection was forcibly closed by the remote host at System.Net.Sockets.Socket.Receive(Byte[] buffer, Int32 offset, Int32 size, SocketFlags socketFlags) at System.Net.Sockets.NetworkStream.Read(Byte[]

Bugzilla SMTP authentication

爷,独闯天下 提交于 2019-12-03 21:08:37
I've installed bugzilla in my local machine (Windows 7) and its working good. But when I try to create a new account it says There was an error sending mail from it@gmail.com to ra@gmail.com : Could't set FROM: 530 5.5.1 Authentication Required. Learn more at at C:/Perl/site/lib/Email/Send/SMTP/TLS.pm line 49. What changes shall I do in TLS.pm ? I've even configured the parameter>Email section in bugzilla: mail_delivery_method = SMTP::TLS , mailfrom = it@gmail.com , smtpserver = smtp.gmail.com:587 , smtp_username = my gmail username, smtp_password = my gmail password, The TLS.pm file line 49

How to send HTML content in email from net//smtp in ruby?

删除回忆录丶 提交于 2019-12-03 20:49:06
Pertinent code: msg = "Subject: Reset password instructions\n\nHello " + @request_payload["email"] + "!\n\n" + "A new account has been created for you at <a href=\"presentation-layer.dev\">presentation-layer.dev<a>." + "Please go to that page and click \"forgot password\" to set your password." smtp = Net::SMTP.new 'smtp.gmail.com', 587 smtp.enable_starttls smtp.start('domain', "email", 'password', :login) do smtp.send_message(msg, 'sender', "recip") end The resulting email just has the raw text in it. How do I get the server to evaluate the HTML tags? To do what you want, you should generate

Sending email using Gmail gives a time out error

一个人想着一个人 提交于 2019-12-03 19:52:25
问题 We are testing some code to send email messages using Gmail from a form, but get a time out error. Can you tell us what is missing from this code to get the email message sent? Try Dim SmtpServer As New SmtpClient() Dim mail As New MailMessage() SmtpServer.EnableSsl = True SmtpServer.Credentials = New Net.NetworkCredential("ouremail@gmail.com", "MyPasswordGoesHere") SmtpServer.Port = 465 SmtpServer.Host = "smtp.gmail.com" mail.From = New MailAddress("ouremail@gmail.com") mail.To.Add("ouremail

Pop3 to SMTP message custom forwarder in C#

[亡魂溺海] 提交于 2019-12-03 19:40:37
问题 I'd like to write a service that periodically checks a POP3 account for new messages and based on custom business logic forwards the messages to an appropriate "To", and possibly changes the "From" as well. I might need to keep some messages on the server until certain conditions are ready for them to be forwarded. I found a sample using Chilkat .NET components that might work: http://www.example-code.com/csharp/pop3_forwarder.asp My question is: Are there any other examples of this in the