【php a simple smtp class】教程文章相关的互联网学习教程文章

php – Yii2:在godaddy托管中无法与主机smtp.gmail.com [连接拒绝#111]建立连接【代码】

我想在Yii2中使用Swift Mailer. 我的主人是Godaddy,我正在尝试使用Gmail帐户发送电子邮件. 代码似乎工作正常,但当我尝试使用它时,我收到错误:无法与主机smtp.gmail.com建立连接[连接拒绝#111] 我仔细检查了我是否使用了正确的gmail凭据.这可能是我的主机的问题,如果有的话,有没有办法解决它?这是代码'mailer' => ['class' => 'yii\swiftmailer\Mailer','transport' => ['class' => 'Swift_SmtpTransport','host'=>'smtp.gmail.co...

在邮件服务器PHPMailer中请求SMTP身份验证【代码】

我正在尝试使用PHPmailer发送邮件.我的webhost已经说过,如果邮件通过他们的数据中心进行中继,则不需要凭据.这是我的代码:$mail->SMTPOptions = array('ssl' => array('verify_peer' => false,'verify_peer_name' => false,'allow_self_signed' => true) );$mail->SMTPSecure = 'ssl'; $mail->SMTPDebug = 2; $mail->isSMTP();$mail->Host = 'smtpgateway.webhost.com'; $mail->SMTPAuth = false; $mail->SMTPSecur...

PHP Swiftmailer与Zoho smtp服务器不发送邮件【代码】

我在Symfony2上使用Swiftmailer.我也使用Zoho邮件来托管我的邮件服务器,我使用Zoho提供的smpt详细信息配置了Swiftmailer,但看起来有些错误,因为引发了以下异常:PHP Fatal error: Uncaught exception 'Swift_TransportException' with message 'Connection could not be established with host 127.0.0.1 [Connection refused #111]'我的parameters.yml文件看起来像:parameters:mailer_transport: smtpmailer_host: smtp.zoho.co...

Google App-Gmail无法设置.通过swiftmailer SMTP传输发送Gmail时从地址替换(PHP)【代码】

您好,感谢您提前提供的任何帮助. 我正在使用swiftmailer,SMTP传输方法从我的PHP脚本发送电子邮件. 发送消息很好.有用. 问题是,无论我将FROM,REPLYTO,SENDER设置为什么,电子邮件都会以GMAIL邮箱(ME-me@mydomain.com)的形式出现.$transport = Swift_SmtpTransport::newInstance('imap.gmail.com', 465,'ssl')->setUsername($login)->setPassword($password); $message = Swift_Message::newInstance($subject)->setFrom(array('test@...

PHP自定义SMTP邮件功能返回ERROR fputs发送字节失败errno = 32管道损坏【代码】

我编写了下一个自定义PHP函数来通过SMTP邮件服务器发送邮件.function send($format = 'text'){$smtpServer = 'mail.mymailserver.com.mx';$port = '25';$timeout = '60';$username = 'myuser';$password = 'mypassword';$localhost = 'www.mydomain.com.mx';$newLine = "\r\n";$smtpConnect = fsockopen( $smtpServer, $port, $errno, $errstr, $timeout );fputs( $smtpConnect,'AUTH LOGIN'.$newLine );f...

php – 未捕获异常’Swift_TransportException’,消息’无法与主机smtp一起建立连接[连接超时#110]’【代码】

我已经在谷歌搜索过它,并在StackOverflow尝试了所有建议,但我仍然遇到致命错误: 我正在使用SwiftMailer发送和发送电子邮件给GMAIL.它在我的localhost上完美运行但是当我上传它并试试它给我一个致命的错误: 这是我的代码的一部分:require_once 'Swift-5.1.0/lib/swift_required.php';$email = "fromemail@gmail.com"; $transport = Swift_SmtpTransport::newInstance('ssl://smtp.gmail.com', 465); $transport->setUsername("us...

php – zend smtp邮件在100封邮件后崩溃【代码】

在发送简报类邮件时,我遇到了这个奇怪的问题. 在for循环中,我遍历数据库中的所有用户并尝试向他们发送包含一些基本信息的所有HTML邮件.现在问题是前200个左右的邮件运行良好,但随后脚本崩溃并发出以下错误:Warning: fwrite(): SSL operation failed with code 1. OpenSSL Error messages: error:140D00CF:SSL routines:SSL_write:protocol is shutdown in /opt/zendframework2/library/Zend/Mail/Protocol/AbstractProtocol.php o...

从SMTP远程服务器CakePHP 3发送电子邮件【代码】

我在配置我的应用程序以从我的smtp服务器发送邮件时遇到一些问题,该服务器位于一个带有1and1的远程主机中.我不知道我是否遗漏了一些东西: >我已将app.php更改为托管服务提供商提供的值:'EmailTransport' => ['default' => ['className' => 'Mail','host' => 'smtp.1and1.com','port' =>'587' ,'timeout' => 30,'username' => 'me@dns.com','password' => '******','client' => null,'tls' => null,], ],'Email' => ['default' =>...

在php中从smtp获取证书【代码】

我有一个PHP函数可以从https-connections获取证书,是否可以扩展它以便能够在smtp-starttls上使用? 我可以将其打开为“tcp://”,并在发送“STARTTLS”命令后将其切换为“ssl://”吗?function ssl_fetch_cert($domain, $port = 443) {$url = "ssl://{$domain}:{$port}";$connection_context_option['ssl']['capture_peer_cert'] = TRUE;$connection_context = stream_context_create($connection_context_option);$connection_cl...

如何使用带有php库的xsmtp-api将替换标签添加到SendGrid中的电子邮件主题【代码】

我正在尝试在电子邮件的主题中设置我的客户的名称.这对我的应用程序以及我在SendGrid API docs中读到的内容非常重要这是很有可能!.Info – Substitution tags will work in the Subject line as well as the body of the email.问题是我似乎无法实现这一目标.起初我可能是因为我已经在电子邮件正文中使用了%name%sub,所以我创建了一个新的替换参数名称%nameSubject%,然而,它不会起作用. 我使用以下代码,电子邮件中的其余参数都...

php – SMTP服务器响应:550 5.7.1无法中继 – 将电子邮件发送到非公司地址【代码】

这是我的代码:<?php mail('myemail@gmail.com','Test','Test'); ?>发送到非公司地址时,我收到以下错误:Warning: mail(): SMTP server response: 550 5.7.1 Unable to relay in C:\inetpub\wwwroot\internal_tools\include\mail.php on line 2将电子邮件地址切换为我的工作电子邮件时,它可以正常工作.我的PHP.ini也很好看:[mail function] ; For Win32 only. ; http://php.net/smtp ;SMTP = localhost SMTP = PCMAIL1.mycompany....

php – 如何从localhost发送smtp邮件【代码】

尝试从我的本地主机发送电子邮件时,我总是收到此消息. SMTP错误:无法连接到SMTP主机.无法发送消息.邮件程序错误:SMTP错误:无法连接到SMTP主机. 以下是我的代码:请帮忙<?php// $email and $message are the data that is being // posted to this page from our html contact form $email = $_REQUEST['email'] ; $message = $_REQUEST['message'] ;// When we unzipped PHPMailer, it unzipped to // public_html/PHPMailer_5....

PHPMailer不适用于Gmail SMTP【代码】

以下代码适用于我的xampp本地服务器,但不会在远程主机上发送电子邮件.我收到此错误:Message could not be sent.Mailer Error: SMTP connect() failedrequire_once('header.php'); require_once('PHPMailer/PHPMailerAutoload.php'); function sendMail($address, $message){$mail = new PHPMailer;//$mail->SMTPDebug = 3; // Enable verbose debug output$mail->isSMTP(); // Set mailer...

php – Laravel SMTP电子邮件【代码】

开始使用Laravel 4.2我尝试使用Gmail STMP服务器发送电子邮件.下面是我的app / config / mail.php.return array('driver' => 'smtp','host' => 'smtp.gmail.com','port' => 465,'from' => array('address' => 'sample_address@gmail.com', 'name' => 'Sample'),'encryption' => 'tls','username' => 'sample_address@gmail.com','password' => 'sample password','sendmail' => '/usr/sbin/sendmail -bs','pretend' => false, );下...

php – SMTP错误:无法连接到SMTP主机【代码】

我有这个代码,一切都在我的本地服务器上运行良好.电子邮件发送没有任何问题. 但现在我将内容传递给网络服务器,我收到了这个错误……SMTP Error: Could not connect to SMTP host.SSL在服务器中启用..正确吗?那么,问题是什么?$mail = new PHPMailer();$mail->IsSMTP();$mail->SMTPAuth = true; // enable SMTP authentication$mail->SMTPSecure = "ssl"; // sets the prefix to the servier$m...

CLASS - 相关标签