SitePoint Sponsor

User Tag List

Results 1 to 6 of 6
  1. #1
    Non-Member
    Join Date
    Sep 2013
    Posts
    8
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    What is the syntax to send a mail in PHP

    What is the syntax to send a mail in PHP.

  2. #2
    SitePoint Mentor silver trophy
    Rubble's Avatar
    Join Date
    Dec 2005
    Location
    Cambridge, England
    Posts
    2,398
    Mentioned
    81 Post(s)
    Tagged
    3 Thread(s)
    Try checking the manual. Write some code and if you have a problem come back and post your code for some help.

  3. #3
    It's all Geek to me silver trophybronze trophy
    ralph.m's Avatar
    Join Date
    Mar 2009
    Location
    Melbourne, AU
    Posts
    24,177
    Mentioned
    454 Post(s)
    Tagged
    8 Thread(s)
    Quote Originally Posted by h1sks View Post
    What is the syntax to send a mail in PHP.
    There are many free PHP form to email scripts available online, so you could google that as well.

  4. #4
    Community Advisor silver trophybronze trophy
    dresden_phoenix's Avatar
    Join Date
    Jun 2008
    Location
    Madison, WI
    Posts
    2,801
    Mentioned
    34 Post(s)
    Tagged
    2 Thread(s)
    You could use something like this:


    Code:
    mail($to, $subject, $message, $headers);
    where $header is a "\r\n" separated list of string segments such as: "From: webmaster@example.com \r\n Reply-To: webmaster@example.com \r\n"


    Do keep in mind that mail() requires that you actually have host permission for this.. so testing in a local PHP install environment is not a good idea.

  5. #5
    SitePoint Member
    Join Date
    Oct 2013
    Posts
    1
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Use this code in Php section
    <?php
    $to = "someone@example.com";
    $subject = "Test mail";
    $message = "Hello! This is a simple email message.";
    $from = "someonelse@example.com";
    $headers = "From:" . $from;
    mail($to,$subject,$message,$headers);
    echo "Mail Sent.";
    ?>

  6. #6
    SitePoint Member
    Join Date
    Feb 2013
    Location
    Chennai
    Posts
    20
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by h1sks View Post
    What is the syntax to send a mail in PHP.
    Basic syntax for sending mail in php

    mail("to","subject","message",[headers]);
    Thanks,
    James
    Web Designer @ DreamDezigns


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
  •