In Feburary 2016 08,
The PHP 'mail' function takes three required and two optional parameters, all of which are strings. The first parameter contains the email address of the recipient. The second has the subject of the message. The third parameter is the email message itself. The fourth parameter contains extra headers such as 'From,' 'Cc' and 'Bcc.' The last parameter contains any flags that should be passed on the command line. The function returns a Boolean value that indicates whether the message was successfully relayed to the mail server. For example:$result = mail($to, $subject, $message, $headers);
Email Size
PHP does not impose any special limits on the size of an email message. It does, however, establish the maximum amount of memory that a single script can consume. This setting is called 'memory_limit' and can be modified in the 'php.ini' setup file, usually found in '/etc/php5/apache2/.' The default setting is 8 MB for PHP versions prior to 5.2 and 128MB in PHP 5.2 and later. Since an email message is a string passed to a function, that string cannot cause the script to exceed the 'memory_limit' parameter. This limit is not affected by email attachments because the contents of an attachment are not passed in memory to a PHP function.
Character Limits
PHP imposes a limit of 70 characters for each line in the text of an email message. This means that you have to insert the line feed character '\n' to break an email message into multiple lines if the message is more than 70 characters long. The PHP 'wordwrap' function will do this for you by passing it the message string and the maximum width of 70, for example:$result = mail($to, $subject, wordwrap($message, 70), $headers);
PHP Relay
PHP does not send an email message. It relays a message to a mail transport agent, or MTA, such as Exim, Microsoft Exchange, Postfix, qmail or Sendmail. The MTA sends the email to the recipient. The return value from the PHP 'mail' function indicates the success of the relay to the MTA, not of the delivery to the recipient. If an MTA imposes restrictions on the size of an email, including attachments, and the message exceeds that limit, the PHP 'mail' function will return a successful result and the message will fail with the MTA. The MTA will typically send an email to the sender indicating that the message was not sent because it exceeded the maximum size permitted.
In Feburary 2016 08,
No comments:
Post a Comment