smtp_mail

Description

Sends email via SMTP.

Syntax

bool smtp_mail (array $mail_to_array, string $subject, string $message, string $headers)



Parameter $mail_to_array

Expected type: Array
Description: An array of email addresses to send the message to



Parameter $subject

Expected type: String
Description: The subject of the message



Parameter $message

Expected type: String
Description: The message



Parameter $headers

Expected type: String
Description: The headers for the email (as set by sendmail())



Return value

Expected type: Boolean
Description: True if successful or false if there was a problem


Notes

  • Depends on the smtp_server, smtp_user, smtp_password and smtp_port settings
  • Will not work if fsockopen, fputs or fclose are disabled
  • Requires that both an SMTP username and an SMTP password be set
  • Awaits appropriate response code from server after each command and returns false if that code isn't received
  • See http://www.networksorcery.com/enp/protocol/smtp.htm for more information on the commands, response codes and all the RFCs pertaining to SMTP
  • Currently does not support secure connections (sorry GMail users!)
Advertisement: