0

以下のコードは以下のアカウントにメールが送信されますが、サーバーで実行するとメールを送信するアクションはなく、コードはエラーではありません。ご協力いただきありがとうございます。

<?php
    $to = "chivycambpp@gmail.com";
    $subject = "Test mail";
    $message = "Hello! This is a simple email message.";
    $from = "chivycambhm@hotmail.com";
    $headers = "From:" . $from;
    mail($to,$subject,$message,$headers);
    echo "Mail Sent.";
?>
4

2 に答える 2

0
$toEmail="your email";
$sub="your subject";
$to=$toEmail;
$subject=$sub;
$from="info@mypropick.com"; 
$headers = "MIME-Version: 1.0\n";
$headers .= "Content-type: text/html; charset=iso-8859-1\n";
$headers .= "From: <".$from.">\n";
$headers .= "X-Priority: 1\n";
$message='<div style=" width:700px; margin:0 auto; border:1px solid #e2e2e2;  padding:20px;">
<h3>MYPROPICK Services:</h3>'.$msg.'</div>';
$message .= "<br/>Regards <br />MYPROPICK.COM";
if(mail( $to, $subject, $message, $headers ))
echo "Mail Sent Successfully";
else
echo "Mail is not sent please set your smtp setting";   
于 2013-03-16T04:54:33.323 に答える
0

これで試してください

<?php 
   /* Setup your Subject and Message Body */ 
   $subject='Testing php Email'; 
   $body=' Put Your Text Message Here.'; 

  /* Specify your SMTP Server, Port and Valid From Address */ 
  ini_set("SMTP","mail.yourdomain.com"); 
  ini_set("smtp_port","25"); 
  ini_set("sendmail_from","fromYou@yourdomain.com"); 

  /* Additional Headers */ 
  $headers = "Cc:Real CC Name <ccUser@theirdomain.com>\r\n"; 
  $headers .= "Bcc:Real BCC Name <bccUser@theirdomain.com>\r\n"; 

  /* Try to send message and respond if it sends or fails. */ 
 if(mail ('ToPersonsName <toPerson@theirdomain.com>', $subject, $body, $headers )){ 
     echo "<h2>Your Message was sent!</h2>"; 
 } 
else{ 
     echo "<font color='red'><h2>Your Message Was Not Sent!</h2></font>"; 
} 
exit; 
?>
于 2013-03-16T04:30:44.760 に答える