Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/.net/20.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
不使用PHPMailer或PEAR的SMTP验证_Php_Email_Ssl_Smtp - Fatal编程技术网

不使用PHPMailer或PEAR的SMTP验证

不使用PHPMailer或PEAR的SMTP验证,php,email,ssl,smtp,Php,Email,Ssl,Smtp,我目前正在一个学校项目中工作,我们必须创建一个具有各种功能的大型网站,但我们不能使用任何类型的库,我想知道如何使用tls应用SMTP验证,而不使用PEAR或任何类似的东西,我目前正在尝试使用此类发送邮件 但这是徒劳的,我正在尝试创建自己的设置来验证它 我是这样测试的: <?php include_once 'private/objects/mailer/mail-handler-class.php'; $mailer = mail_handler::get_instance();

我目前正在一个学校项目中工作,我们必须创建一个具有各种功能的大型网站,但我们不能使用任何类型的库,我想知道如何使用tls应用SMTP验证,而不使用PEAR或任何类似的东西,我目前正在尝试使用此类发送邮件

但这是徒劳的,我正在尝试创建自己的设置来验证它

我是这样测试的:

<?php

include_once 'private/objects/mailer/mail-handler-class.php';

$mailer = mail_handler::get_instance();

$mailer->set_message("<b>This is a message</b>");
$mailer->set_subject("A test message!");

$mailer->is_html();
$mailer->is_smtp();

$mailer->set_smtp_host("********");
$mailer->set_smtp_port(587); #the port

$mailer->set_smtp_auth_username("*******"); #smtp authentication username
$mailer->set_smtp_auth_password("**********"); #smtp authentication password

$mailer->set_sender("test@********.nl"); #sender
$mailer->set_receiver("********@gmail.com"); #receiver

if(!$mailer->send_mail()) {
    echo "failed";
} else {
    echo "sent!";
}

你的主机提供商是什么?@SumanDey我在使用transpi,我想你使用的是普通的php电子邮件脚本。如果您使用smtp,请转到phpmailer@SumanDey我不能使用phpmailer,我们不能使用任何库,因为您使用普通邮件,所以它不需要任何库或smtp。Cpanel在一小时内免费发送500封邮件。你可以用这个。