简体   繁体   English

电子邮件地址中的php邮件功能显示邮件服务器地址

[英]php mail function from email address shows mail server address

Following are my code to send reservation from a form. 以下是我从表单发送预订的代码。 Everything is sent as per the form but the in my inbox FROM section it shows mail server address instead of showing senders email address. 一切都按照表格发送,但是在我的收件箱“发件人”部分中,它显示邮件服务器地址,而不显示发件人的电子邮件地址。

<?php 
  if(isset($_POST['rsubmit'])){ 
      //echo "samir karmachary"; 
      $fname=$_POST['fname']; 
      $remail=$_POST['remail']; 
      $rphone=$_POST['rphone']; 
      $pick_up_date=$_POST['pick_up_date']; 
      $pick_up_time=$_POST['pick_hour'].":".$_POST['pick_min']."".$_POST['pick_ampm']; 
      $taxitype=$_POST['taxitype']; 
      $ploc=$_POST['ploc']; 
      $dloc=$_POST['dloc']; 
      $passangerno=$_POST['passangerno']; 
      $luggageno=$_POST['luggageno']; 
      $comment=$_POST['comment']; 
      $payment_type=$_POST['payment_type']; 
      $to='example@address.com'; 
      // subject 
      $subject = 'Reservation detail convenience'; 
      // message 
      $message = ' <html> <head> <title>Reservation Detail Convenience</title> </head>     <body> <table width=100% cellpadding="4" cellspacing="4"> <tr><td width="30%" >Name :</td><td>'.$fname.'</td></tr> <tr><td>Email :</td><td>'.$remail.'</td></tr> <tr> <td>Phone :</td><td>'.$rphone.'</td></tr> <tr><td>Pick up Date:</td><td>'.$pick_up_date.'</td></tr> <tr><td>Pick up Time:</td><td>'.$pick_up_time.'</td></tr> <tr><td>Taxi Type:</td><td>'.$taxitype.'</td></tr> <tr><td>Pick Up location:</td><td>'.$ploc.'</td></tr> <tr><td>Drop Of Location:</td><td>'.$dloc.'</td></tr> <tr><td>Passanger No:</td><td>'.$passangerno.'</td></tr> <tr><td>Luggage No:</td><td>'.$luggageno.'</td></tr> <tr><td>Comment:</td><td>'.$comment.'</td></tr> <tr><td>Payment:</td><td>'.$payment_type.'</td></tr> </table> </body> </html> '; 
      // To send HTML mail, the Content-type header must be set 
      $headers = 'MIME-Version: 1.0' . "\r\n"; 
      $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n"; 
      // Additional headers 
      $headers .= 'From: Convernience<Convernience>' . "\r\n"; 
      if(mail($to, $subject, $message, $headers)){ 
          $to=$remail; mail($to, $subject, $message, $headers); 
          echo "<script type='text/javascript'>alert('Reservation successfully');</script>"; 
      }else{ 
          echo "<script type='text/javascript'>alert('Sorry please try again');</script>"; 
      } 
  }
?>

This is normal. 这很正常。 It really depends on the web server where you are hosting and the email service you are using. 这实际上取决于您托管的Web服务器和所使用的电子邮件服务。 Research your hosting where you use the mail function. 研究使用邮件功能的主机。 Most likely this happens because you pretend to send the message from person who fills up the form on your website and the mail server detects it as fraudulent... my guess... when I had the same problem and did some poking around. 发生这种情况的可能性最大,是因为您假装向填写您网站上表单的人发送邮件,并且邮件服务器将其检测为欺诈邮件...我的猜测...当我遇到相同的问题并进行了一些摸索时。

Hope this was helpful. 希望这会有所帮助。

I believe the from: portion has to be RFC 2822-compliant (an email address format). 我相信from:部分必须符合RFC 2822(电子邮件地址格式)。 See Here: http://php.net/manual/en/function.mail.php 参见此处: http : //php.net/manual/zh/function.mail.php

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM