ฟังก์ชั่นเมล PHP
PHP Mail Introduction
ฟังก์ชัน mail() ช่วยให้คุณสามารถส่งอีเมลได้โดยตรงจากสคริปต์
ความต้องการ
เพื่อให้ฟังก์ชันเมลใช้งานได้ PHP จำเป็นต้องมีระบบอีเมลที่ติดตั้งและใช้งานได้ โปรแกรมที่จะใช้ถูกกำหนดโดยการตั้งค่าคอนฟิกในไฟล์ php.ini
การติดตั้ง
ฟังก์ชันเมลเป็นส่วนหนึ่งของแกน PHP ไม่จำเป็นต้องติดตั้งเพื่อใช้ฟังก์ชันเหล่านี้
การกำหนดค่ารันไทม์
การทำงานของฟังก์ชันเมลได้รับผลกระทบจากการตั้งค่าใน php.ini:
Name | Default | Description | Changeable |
---|---|---|---|
mail.add_x_header | "0" | Add X-PHP-Originating-Script that will include UID of the script followed by the filename. For PHP 5.3.0 and above | PHP_INI_PERDIR |
mail.log | NULL | The path to a log file that will log all mail() calls. Log include full path of script, line number, To address and headers. For PHP 5.3.0 and above | PHP_INI_PERDIR |
SMTP | "localhost" | Windows only: The DNS name or IP address of the SMTP server | PHP_INI_ALL |
smtp_port | "25" | Windows only: The SMTP port number. For PHP 4.3.0 and above | PHP_INI_ALL |
sendmail_from | NULL | Windows only: Specifies the "from" address to be used when sending mail from mail() | PHP_INI_ALL |
sendmail_path | "/usr/sbin/sendmail -t -i" | Specifies where the sendmail program can be found. This directive works also under Windows. If set, SMTP, smtp_port and sendmail_from are ignored | PHP_INI_SYSTEM |
ฟังก์ชั่นเมล PHP
Function | Description |
---|---|
ezmlm_hash() | Calculates the hash value needed by EZMLM |
mail() | Allows you to send emails directly from a script |