Php邮件工作不正常 [英] Php mailer not working properly
问题描述
我使用php邮件程序从localhost发送邮件但它无法正常工作并显示以下给出的错误:
无效地址:SMTP - >错误:服务器不接受密码:534-5.7.14请通过网络浏览器登录,然后重试。 534-5.7.14了解更多信息,请点击534 5.7.14 https://support.google.com/mail/bin/answer.py?answer=78754 4sm6769939pdo.19 - gsmtp
SMTP错误:可能不认证。
我用来发送邮件的代码是 -
<? php
if(isset($ _ REQUEST ['send']))
{
$ t < span class =code-keyword> = $ _ POST [' to'];
< span class =code-summarycomment>
$ s = $ _ POST [' subject'];
$ b = $ _ POST [' body'];
require_once('phpmailer / class.phpmailer.php');
$ mail = new PHPMailer();
$ mail - > IsSMTP();
$ mail-> SMTPAuth = true;
$ mail-> SMTPDebug = 1;
$ mail-> SMTPSecure =ssl;
$ mail-> Username =kakminder@gmail.com;
$ mail->密码=;
$ mail-> Host =smtp.gmail.com;
$ mail-> Mailer ='smtp';
$ mail-> Port = 465;
$ mail-> SetFrom('asd@gmail.com','asd');
$ mail-> Subject = $ s;
$ mail-> Body =helo测试邮件;
$ mail-> AddAddress($ t);
$ mail-> AddAddress('saini.1985 @ gmail.com','deepak');
$ mail-> AddAddress('kak@rediffmail.com','akm');
$ mail-> Send() ;
}
?>
< html > < h1 < span class =code-keyword>> 发送邮件< / h1 < span class =code-keyword>>
< body >
< 表格 >
< 表 align = center border = 1 < span class =code-keyword>>
< tr > < td > 到< / td > < td > < 输入 type = text name = to / > < / td > ; < / tr >
< tr > < td > subje ct < / td > < span class =code-keyword>< td > < 输入 type = text name = subject < span class =code-attribute> / > < / td > < / tr >
< tr > < td > body < ; / td > < td > < 输入 type = text 名称 = body / > < / td > < / tr >
< tr > < td > < 输入 type = 提交 名称 = 发送 值 = 发送 / > < / td > < / tr >
< / table > < / form > < / body > < / html >
我在php.ini文件中取消注释openssl.dll。
但仍然是我的代码无效。
谢谢
_REQUEST ['send']))
{
t =
_POST [' to'];
Hi,
I am using php mailer to send mail from localhost but it is not working and showing the below given error:
Invalid address: SMTP -> ERROR: Password not accepted from server: 534-5.7.14 Please log in via your web browser and then try again. 534-5.7.14 Learn more at 534 5.7.14 https://support.google.com/mail/bin/answer.py?answer=78754 4sm6769939pdo.19 - gsmtp
SMTP Error: Could not authenticate.
The code i am using to send mail is-
<?php
if(isset($_REQUEST['send']))
{
$t=$_POST['to'];
$s=$_POST['subject'];
$b=$_POST['body'];
require_once('phpmailer/class.phpmailer.php');
$mail = new PHPMailer();
$mail->IsSMTP();
$mail->SMTPAuth = true;
$mail->SMTPDebug = 1;
$mail->SMTPSecure = "ssl";
$mail->Username = "kakminder@gmail.com";
$mail->Password = ";
$mail->Host = "smtp.gmail.com";
$mail->Mailer = 'smtp';
$mail->Port = 465;
$mail->SetFrom('asd@gmail.com', 'asd');
$mail->Subject = $s;
$mail->Body = "helo testing mail";
$mail->AddAddress($t);
$mail->AddAddress('saini.1985@gmail.com','deepak');
$mail->AddAddress('akm@rediffmail.com','akm');
$mail->Send();
}
?>
<html><h1>Sending mail</h1>
<body>
<form>
<table align="center" border="1">
<tr><td>to</td><td><input type="text" name="to" /></td></tr>
<tr><td>subject</td><td><input type="text" name="subject" /></td></tr>
<tr><td>body</td><td><input type="text" name="body" /></td></tr>
<tr><td><input type="submit" name="send" value="send" /></td></tr>
</table></form></body></html>
I have uncomment openssl.dll in php.ini file.
But still my code is not working.
Thanks
_REQUEST['send'])) {
t=
_POST['to'];
这篇关于Php邮件工作不正常的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!