0

我有一个联系页面和一个页面,其中来自联系页面的表单数据发布到问题是我可以使用 XAMPP 从本地主机发送电子邮件,但是当我上传文件时它在我的服务器上不起作用。没有什么问题我的服务器的传出 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>');
}
?>
4

0 回答 0