+ Reply to Thread
Results 1 to 6 of 6

Thread: cegonsoft reviews | PHP Mail

  1. #1

    Default cegonsoft reviews | PHP Mail

    PHP Mail

    PHP's mail() function is used to create and send emails. The function can accept a number of parameters:

    1. To (required string)
    2. Subject (required string)
    3. Message (required string) - each line should end in a new line control character (\n), and line length should be within 70 characters.
    4. Additional headers (optional)
    - From
    - CC
    - BCC
    - Other headers
    5. Additional parameters (optional)

    Example:

    <html>
    <head>
    <title>Email</title>
    </head>
    <body>
    <?php
    $to = "Email address";
    $subject = "Test Mail";
    $body = "Hello ";
    $headers = "From: Your email";
    $sent = mail($to, $subject, $body, $headers);
    if($sent)
    echo "Mail sent to $to";
    else
    echo "Error sending mail";
    ?>
    </body>
    </html>


    Visit: Cegonsoft

  2. #2

    Default

    <?php

    // Your email address

    $email = "you@example.com";

    // The subject

    $subject = "Enter your subject here";

    // The message

    $message = "Enter your message here";

    mail($email, $subject, $message, "From: $email");

    echo "The email has been sent.";

    ?>

    cegonsoft

  3. #3
    Ruby Star member nobita_deptrai is on a distinguished road
    Join Date
    Jun 2011
    Posts
    458

    Default

    PHP seems to make most things extremely easy. Sending mail is no exception.
    Send Email from a PHP Script

    All it takes is the right configuration (to send mail using a local or a remote server) and one function:

    mail().
    Send Email from a PHP Script Example

    The first argument to this function is the recipient, the second specifies the message's subject and the third one should contain the body. So to send a simple sample message, we could use:

    <?php
    $to = "recipient@example.com";
    $subject = "Hi!";
    $body = "Hi,\n\nHow are you?";
    if (mail($to, $subject, $body)) {
    echo("<p>Message successfully sent!</p>");
    } else {
    echo("<p>Message delivery failed...</p>");
    }
    ?>
    That's it! Note that you can have PHP validate your email addresses for correctness before sending.

    Use Custom Headers (e.g. "From:") in Mail from a PHP Script

    Do you want to set a custom From: address, maybe taken from the form you send, or another custom header line? It is but an additional argument you need.

    Protecting Your Script from Spammer Exploit

    If you use the mail() function (in combination with a web form in particular), make sure you check it is called from the desired page and protect the form with a CAPTCHA maybe. You can also check for suspicious strings in any arguments (say, "Bcc:" followed by a number of email addresses).

    Send Email from a PHP Script with SMTP Authentication

    If mail() does not work for you, you have options, too. The mail() function included with stock PHP does not support SMTP authentication, for example. If mail() does not work for you for this or another reason, try the PEAR Mail package, which is much more comprehensive and sending mail almost as easily from your PHP scripts.
    BDS Real Estate Company
    Go to my website rao vat ban nha to learn about real estate in Vietnam: Home sales , Apartment for sale, Feng Shui ...

  4. #4
    Prospect aalas is on a distinguished road
    Join Date
    Nov 2011
    Location
    USA
    Posts
    8

    Default

    Thank you very much for this nice code. Exactly what I was looking for.

  5. #5

    Default cegonsoft reviews | application projects programs for ECE Freshers in Cegonsoft

    Cegonsoft Final Year Engineering Projects
    IEEE Projects In | JAVA | DOT NET | PHP | J2EE | RDBMS | Flow Charts | Project Synopsis | Documentation | In Bangalore
    Benefits of IEEE Projects
    • Awareness and experience with the advanced Software technology
    • Modern Technology skills and Knowledge.
    • Experience with IEEE Environment.
    We are providing final year projects based on System side, Web application and IEEE projects.
    System side Application in java (Swing and Applets)
    Web Application in different technologies
    J2EE with advanced concepts
    ASP.net
    PHP/MYSQL with Ajax
    IEEE projects in different Transaction
    IEEE in Networking
    IEEE in Neural Network
    IEEE in Distributed Computing
    IEEE in Mobile Computing
    IEEE in Software Engineering
    IEEE in Image Processing

  6. #6

    Default

    This post is very helpful for me.Thanks For sharing it.

+ Reply to Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts