Applies To:
[ Zend Core V2.x ]
[ IBM System i ]
Preface
The PHP mail() function is used to send emails from inside a script.
The following mail extension is provided with the zend core for i5/OS products and should already be loaded with the core installation. zmail - Zend SMTP module
Details
The PHP mail() Function
The PHP mail() function is used to send emails from inside a script, PHP Simple E-Mail Syntax:
bool mail ( string $to , string $subject , string $message [, string $additional_headers [, string $additional_parameters ]] )
Parameter | Description | Required |
$to | Specifies the receiver / receivers of the email | X |
$subject | Specifies the subject of the email. Note: This parameter cannot contain any newline characters | X |
$message | Defines the message to be sent. Each line should be separated with a LF (\n). Lines should not exceed 70 characters | X |
$headers | Specifies additional headers, like From, Cc, and Bcc. The additional headers should be separated with a CRLF (\r\n) |
|
$parameters | Specifies an additional parameter to the sendmail program | |
PHP Simple E-Mail
- Altering the mail() options Dynamically with ini_set():
- PHP's ini_set() function temporarily sets a given configuration option for the duration of the program that invoked it.
- ini_set() takes two parameters
- Varname - Variable/option to change
- Newvalue - Value to change to
- The following lines of code show how to set the SMTP server and "from" address within a PHP function.
Example:
2. Setting the mail() options Static php.ini parameters:
Example:
Troubleshooting
- Changes to PHP.INI will take effect after the Apache server is restarted
- To view mail() unexpected behaviour, see PHP's error log: /usr/local/zend/Core/logs/php_error_log
The error log may be viewed with a text editor or this command: EDTF '/usr/local/zend/Core/logs/php_error_log'
Excerpt: The PHP mail() function is used to send emails from inside a script.
Original Post Date: 2009-05-31 14:06:00
External Links: php manual
PHP: Zend for i5/OS