Results 1 to 3 of 3

Thread: How to send email using PHP mail function

  1. #1
    Join Date
    Mar 2009
    Posts
    176

    How to send email using PHP mail function

    I would like to send emails from my PHP program. Is it possible? I think we need to use PHP mail function but don't how and where to use it. Can any one help me or just provide me the syntax with a basic idea of how to use it?

  2. #2
    Join Date
    May 2008
    Posts
    2,012

    Re: How to send email using PHP mail function

    Here is an example of how to use PHP mail function:

    PHP Code:
    <?php
    $to 
    "abc@site.com";
    $subject "Hello World!";
    $body "Welcome to PHP mail function.";
    $headers "From: pqr@mysite.com \n" .
    $sent mail ($to$subject$body$headers);
    if (
    $sent)
    {
    echo 
    "Thank you!";
    }
    else
    {
    echo 
    'Failed';
    }
    ?>

  3. #3
    Join Date
    Feb 2008
    Posts
    194

    Re: How to send email using PHP mail function

    PHP mail () function

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

    Parameters
    • to: Receiver, or receivers of the mail.
    • subject: Subject of the email to be sent.
    • message: Message to be sent. [Each line should be separated with a LF (\n). Lines should not be larger than 70 characters.]
    • additional_headers (optional): String to be inserted at the end of the email header. [This is typically used to add extra headers (From, Cc, and Bcc). Multiple extra headers should be separated with a CRLF (\r\n).]
    • additional_parameters (optional): The additional_parameters parameter can be used to pass additional flags as command line options to the program configured to be used when sending mail, as defined by the sendmail_path configuration setting.

Similar Threads

  1. Cannot send email by Windows Live Mail
    By Nickason in forum Vista Help
    Replies: 7
    Last Post: 25-08-2011, 12:26 PM
  2. Unable to Send Email in Apple Mail
    By Orrin in forum Technology & Internet
    Replies: 5
    Last Post: 25-12-2010, 06:20 PM
  3. Windows live mail couldn't send email but can receive email
    By danielyen in forum Windows Software
    Replies: 1
    Last Post: 15-07-2010, 12:17 AM
  4. Can't send email with gmail in windows mail
    By criscent in forum Windows Vista Mail
    Replies: 2
    Last Post: 10-08-2009, 11:26 AM
  5. Cannot send gif image in email using windows mail
    By Gopesh in forum Windows Software
    Replies: 3
    Last Post: 04-06-2009, 01:29 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,711,652,628.93984 seconds with 16 queries