求教百度开发平台中 我用phpmail 总是提示500 Internal Server Error 怎么解决
展开全部
BAE禁用函数mail,使用函数mail会出现错误
BAE中可以用socket系列函数通过smtp协议发送邮件
<?php
$server = "smtp服务器IP或域名如smtp.163.com";
$port = 25;//默认25
$username = "账户名如abc@example.com" ;
$password = "";//密码
$sendto = "";//邮件接收者地址
$data = "";//邮件内容
$sock = socket_create(AF_INET,SOCK_STREAM,SOL_TCP);
if(socket_connect($sock,$server,$port)===false)socket_strerror(socket_last_error());
echo socket_read($sock,100)."<br>";
socket_write($sock,"HELO lyz810\r\n");
echo socket_read($sock,100)."<br>";
socket_write($sock,"AUTH LOGIN\r\n");
echo socket_read($sock,100)."<br>";
socket_write($sock,base64_encode($username)."\r\n");
echo socket_read($sock,100)."<br>";
socket_write($sock,base64_encode($password)."\r\n");
echo socket_read($sock,100)."<br>";
socket_write($sock,"MAIL FROM:<".$username.">\r\n");
echo socket_read($sock,100)."<br>";
socket_write($sock,"RCPT TO:<".$sendto.">\r\n");
echo socket_read($sock,100)."<br>";
socket_write($sock,"DATA\r\n");
echo socket_read($sock,100)."<br>";
socket_write($sock,$data."\r\n.\r\n");
socket_write($sock,"QUIT");
echo socket_read($sock,100)."<br>";
?>
以上是最简单的一种发邮件的方法,根据需要进行修改
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询