SitePoint Sponsor

User Tag List

Results 1 to 4 of 4

Hybrid View

  1. #1
    SitePoint Addict
    Join Date
    Feb 2006
    Posts
    299
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Help Me With Sending Emails Using Php

    I would like someone to help me with scripts in php that will send e-mails to the following;
    1 To the receiver
    2 To the Sender

    It should also send the URL where the receiver will click to see the interface to login.
    This when the user fill in some form.
    The scripts below is not working

    <?php
    mail("$sender",, "My Subject", "Line 1\nLine 2\nLine 3");
    mail("$Receiver",, "My Subject", "Line 1\nLine 2\nLine 3");

    ?>

  2. #2
    Dinah-Moe Humm mudshark's Avatar
    Join Date
    Dec 2003
    Posts
    1,072
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    By putting two comma's, you're shifting the parameters of the mail function (there's only three needed, the fourth (headers) is optional). Also, variables should not be quoted. Lastly: are you sure $sender and $Receiver are actually set?
    Try this:
    PHP Code:
    <?php
    mail
    ($sender"My Subject""Line 1\nLine 2\nLine 3");
    mail($Receiver"My Subject""Line 1\nLine 2\nLine 3");
    ?>
    and maybe read up on the mail function.

  3. #3
    Follow Me On Twitter: @djg gold trophysilver trophybronze trophy Dan Grossman's Avatar
    Join Date
    Aug 2000
    Location
    Philadephia, PA
    Posts
    20,578
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by zamzam
    I would like someone to help me with scripts in php that will send e-mails to the following;
    1 To the receiver
    2 To the Sender

    It should also send the URL where the receiver will click to see the interface to login.
    This when the user fill in some form.
    The scripts below is not working

    <?php
    mail("$sender",, "My Subject", "Line 1\nLine 2\nLine 3");
    mail("$Receiver",, "My Subject", "Line 1\nLine 2\nLine 3");

    ?>
    This is the correct syntax for sending a mail:
    PHP Code:
    mail("recipient@example.com""Subject Text""Body Text""From: sender@example.com"); 
    Specifically for you:
    PHP Code:
    mail($receiver"My Subject""Line 1\nLine 2\nLine3""From: $sender\nBCC: $receiver"); 

  4. #4
    SitePoint Wizard siteguru's Avatar
    Join Date
    Oct 2002
    Location
    Scotland
    Posts
    3,631
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    This assumes that the web host still allows the PHP mail() function to be used.
    Ian Anderson
    www.siteguru.co.uk


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
  •