开发者

i want to know the simplest easiet code of mail using php

i want to know the simplest easiet code of mail using p开发者_如何学Gohp


Your question isn't clear but here is the simplest use of the mail function:

// The message
$message = "Line 1\nLine 2\nLine 3";

// In case any of our lines are larger than 70 characters, we should use wordwrap()
$message = wordwrap($message, 70);

// Send
mail('caffeinated@example.com', 'My Subject', $message);

See the docs for more information

Note:

There are issues with using mail function:

  • Email might be treated as spam
  • The SMTP socket is issued for each mail
  • Can not be used for bulk-emailing
  • Unreliable use of new line character across plateforms

Better Alternatives:

You should when you can use PHPMailer

Or:

The SwiftMailer


 mail('bill@gmail.com', 'subject', 'Whazup');


<?php
mail('caffeinated@example.com', 'My Subject', $message);
?>

From the php doc.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜