Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • PHP mail() function

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 121
    Comment on it

    To send email in PHP, we use mail() function. You can send text message, html message and attachment with message by the use of PHP mail() function.

    Syntax

    bool mail ( string $to , string $subject , string $message [, string $additional_headers [, string $additional_parameters ]] )

    $to specifies receiver or receivers of the mail. The receiver must be specified one of the following forms.

    user@example.com
    user@example.com, anotheruser@example.com
    User user@example.com
    User user@example.com
    $subject
    represents subject of the mail.

    $message
    represents message of the mail to be sent.

    PHP mail Example

    <?php  
       $to = "pranav.chhabra456@gmail.com";
       $subject = "This is subject";  
       $message = "This is simple text message.";  
       $header = "From:mukesh.tomar@evontech.com \r\n";  
       $result = mail ($to,$subject,$message,$header);  
    
       if( $result == true ){  
          echo "Message sent successfully...";  
       }else{  
          echo "Sorry, unable to send mail...";  
       }  
    ?>  
    

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: