I want to learn the simplest messaging code using php

I want to find out the simplest simple mail code using php

0
source share
3 answers

Your question is not 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 details.

Note:

There are problems using the mail function:

  • Email may be considered spam.
  • SMTP socket issued for each mail
  • Cannot be used for bulk email
  • Insecure use of new line symbol in records

Best alternatives:

You should, if you can use PHPMailer

Or:

Swiftmailer

+3
source
  mail(' bill@gmail.com ', 'subject', 'Whazup'); 
+1
source
 <?php mail(' caffeinated@example.com ', 'My Subject', $message); ?> 

From php doc .

+1
source

Source: https://habr.com/ru/post/1334631/


All Articles