Tuesday, 17 May 2011

Learn PHP online : PHP Day-18

Mail Function In PHP


                                                                
Mail Function In PHP

By using this function we can send the mails from php application to destination email id. The arguments are “to address, subject, body, and collection of headers”.

*To send mails from one location to another location we have to use the “SMTP SERVER”.

*The default port number of SMTP server is 25. The fourth argument, We can place the multiple headers.

*The fourth argument, we can place the multiple headers. The separated between one header and another header is “\r\n”. 

The mail related headers are nothing but cc, bcc, from etc.


<?php
if(mail("abc@gmail.com",hi","hello",From:DanielPHP"))
echo "mail has been sent";
else
echo "not";
?>


No comments:

Post a Comment

Visual comparison of the two methods, creating a simple table.

Option 1, using PHP: // PHP $html = '<table>' ;     foreach ( $data as $row ) {     $html .= '<tr>...