ページの作成:「== 概要 == <code>mail</code>関数または<code>mb_send_mail</code>関数を使用して、メールを送信する手順を記載する。<br> <br><br> == ASCIIメ…」
 
3行目: 3行目:
<br><br>
<br><br>


== ASCIIメールの送信(mail関数) ==
== ASCIIメールの送信 : mail関数 ==
ASCIIメールの送信を行うには、<code>mail</code>関数を使用する。<br>
ASCIIメールの送信を行うには、<code>mail</code>関数を使用する。<br>
  bool mail ( string to,  
  bool mail ( string to,  
56行目: 56行目:
   
   
  mail($to, $subject, $message, $headers);
  mail($to, $subject, $message, $headers);
</syntaxhighlight>
<br>
<syntaxhighlight lang="php">
<?php
    $to = 'you@example.com';
    $subject = 'test mail';
    $message = "This is Test mail¥nMulti Line";
    $message = wordwrap($message, 70, "¥n");
    $headers = 'From: my@example.com'."¥r¥n".
              'To: you@example.com'."¥r¥n".
              'X-Mailer: PHP/Mail';
    if(mail($to, $subject, $message, $headers))
    {
      print('成功');
    }
    else
    {
      print('エラー');
    }
?>
  </syntaxhighlight>
  </syntaxhighlight>
<br><br>
<br><br>