邮件没有使用phpmailer发送 [英] Mail not getting send using phpmailer

查看:61
本文介绍了邮件没有使用phpmailer发送的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在ifinityfree.net上托管了我的网站,它不支持mail()函数所以我使用phpmailer我是这个函数的新手。它显示错误



sikderbrightfuture.co.in目前无法处理此请求。 HTTP ERROR 500

我不知道该怎么办请帮忙!!

先谢谢。

I have hosted my site on ifinityfree.net which don't support mail() function so i am using phpmailer i am new to this function. it is showing error

sikderbrightfuture.co.in is currently unable to handle this request. HTTP ERROR 500
I don't know what to do please help!!
Thanks in Advance.

<?php

date_default_timezone_set('Etc/UTC');

// Edit this path if PHPMailer is in a different location.
require_once ("phpmailer\PHPMailerAutoload.php");

$mail = new PHPMailer;
$mail->isSMTP();

/*
 * Server Configuration
 */

$mail->Host = 'smtp.gmail.com'; // Which SMTP server to use.
$mail->Port = 587; // Which port to use, 587 is the default port for TLS security.
$mail->SMTPSecure = 'tls'; // Which security method to use. TLS is most secure.
$mail->SMTPAuth = true; // Whether you need to login. This is almost always required.
$mail->Username = "myemailid@gmail.com"; // Your Gmail address.
$mail->Password = "gmailpass"; // Your Gmail login password or App Specific Password.

/*
 * Message Configuration
 */

$mail->setFrom('myemailid@gmail.com', 'Aditya'); // Set the sender of the message.
$mail->addAddress('mailto@gmail.com', 'Person'); // Set the recipient of the message.
$mail->Subject = 'PHPMailer GMail SMTP test'; // The subject of the message.

/*
 * Message Content - Choose simple text or HTML email
 */

// Choose to send either a simple text email...
$mail->Body = 'This is a plain-text message body'; // Set a plain text body.

// ... or send an email with HTML.
//$mail->msgHTML(file_get_contents('contents.html'));
// Optional when using HTML: Set an alternative plain text message for email clients who prefer that.
//$mail->AltBody = 'This is a plain-text message body'; 

// Optional: attach a file

if ($mail->send()) {
    echo "Your message was sent successfully!";
} else {
    echo "Mailer Error: " . $mail->ErrorInfo;
}





我的尝试:



1)我尝试将SMTP模式从tls转换为ssl和端口号。



What I have tried:

1) I tried chaning the SMTP mode from tls to ssl and port no.

推荐答案

mail = new PHPMailer;
mail = new PHPMailer;


mail-> isSMTP();

/ *
*服务器配置
* /
mail->isSMTP(); /* * Server Configuration */


mail-> Host = ' smtp.gmail.com'< /跨度>; // 使用哪个SMTP服务器。
mail->Host = 'smtp.gmail.com'; // Which SMTP server to use.


这篇关于邮件没有使用phpmailer发送的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆