我有一个联系页面和一个页面,其中包含来自联系页面的数据 问题是我可以使用XAMPP从localhost使用pear邮件发送电子邮件,但是当我上传文件时它在我的服务器上不起作用。我的服务器的传出smtp没有任何问题,而我可以使用outlook发送消息。谢谢你的帮助谁知道问题究竟是什么! 这是将数据发布到的页面:
<?php
include_once('Mail.php');
include_once ('securimage/securimage.php');
$securimage = new Securimage();
if ($securimage->check($_POST['captcha_code']) == false) {
echo "<p>The captcha code you entered is wrong<br/></p>";
exit;
}
$clientip=$_SERVER['REMOTE_ADDR'];
$name=$_POST['txtname'];
$family=$_POST['txtfamily'];
$email=$_POST['txtemail'];
$message=$_POST['txtmessage'];
$to = 'nowrouziehsan@gmail.com';
$from=$email;
$subject = 'Sent from my website';
$body ="Name : ".$name."\n"."Family : ".$family."\n"."Email : ".$email."\n".
"Client IP Address : ".$clientip."\n"."Message :\n".$message;
$headers = array(
'From' => $from,
'To' => $to,
'Subject' => $subject
);
$smtp = Mail::factory('smtp', array(
'host' => 'mail.alijamshidi.org',
'port' => '25',//it works fine on the port 587 as well...
'auth' => true,
'username' => 'info@alijamshidi.org',
'password' => 'mypassword'
));
$mail = $smtp->send($to, $headers, $body);
if (PEAR::isError($mail)) {
echo('<p>' . $mail->getMessage().'</p>');
} else {
echo('<p>You have successfully sent the message , stay in tune while we reply you
back</p>');
}
?>