SitePoint Sponsor

User Tag List

Results 1 to 8 of 8

Thread: mail function

  1. #1
    SitePoint Enthusiast
    Join Date
    Jan 2006
    Posts
    41
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    mail function

    i want to send the value of form, when u use mail function given belowwith cc and bcc, mail has been not sent.

    $headers .= "To: Mary <mary@example.com>, Kelly <kelly@example.com>\r\n";
    $headers .= "From: Birthday Reminder <birthday@example.com>\r\n";
    $headers .= "Cc: birthdayarchive@example.com\r\n";
    $headers .= "Bcc: birthdaycheck@example.com\r\n";

    mail($to, $subject, $message, $headers);

    when i used mail function
    mail($to, $subject, $message, 'From:support@getcallsfree.com');
    mail will send

    how can i use cc and bcc in my mail function. what is the problem
    kindly help me

  2. #2
    SitePoint Zealot forum11's Avatar
    Join Date
    Feb 2006
    Posts
    142
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    use small letters cc instead of Cc then try again
    $headers .= "cc: birthdayarchive@example.com\r\n";
    $headers .= "bcc: birthdaycheck@example.com\r\n";

  3. #3
    SitePoint Enthusiast
    Join Date
    Jan 2006
    Posts
    41
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    can i send mail without giving 'From:support@getcallsfree.com'

  4. #4
    SitePoint Zealot forum11's Avatar
    Join Date
    Feb 2006
    Posts
    142
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I don't think so

  5. #5
    SitePoint Enthusiast
    Join Date
    Jan 2006
    Posts
    41
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    this is my php code , i want 'emailer@bettersitesolutions.com' as bcc what will i change so it works . the solution given before is not working .

    if(isset($_POST['hid']))
    {
    $fname=$_POST['txtFName'];
    $email=$_POST['txtEmail'];
    $comment=$_POST['txtComment'];

    $message1="\r\n\nFirst Name Of Client=".$fname;
    $message1.="\r\n\nLast Email Of Client=".$email;
    $message1.="\r\n\nComment=".$comment;

    //$headers .= "To: Mary <mary@example.com>, Kelly <kelly@example.com>\r\n";
    $subject="client information of party contact";
    mail('rentitjdb@budget.net',$subject,$message1,'From:support@getcallsfree.com')or die("can not send the mail".mysql_error()) ;
    mail('emailer@bettersitesolutions.com',$subject,$message1,'From:support@getcallsfree.com')or die("can not send the mail".mysql_error()) ;
    echo "<br><div align=center>mail has been sent to rentitjdb@budget.net </div>";}
    ?>

  6. #6
    SitePoint Wizard silver trophy Jelena's Avatar
    Join Date
    Feb 2005
    Location
    Universum, 3rd Corner
    Posts
    3,000
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    PHP Code:
    <?php

    if(isset($_POST['hid']))
    {
    $fname=$_POST['txtFName'];
    $email=$_POST['txtEmail'];
    $comment=$_POST['txtComment'];

    $message1="\r\n\nFirst Name Of Client=".$fname;
    $message1.="\r\n\nLast Email Of Client=".$email;
    $message1.="\r\n\nComment=".$comment;

    $headers .= 'From: [email]support@getcallsfree.com[/email]' "\r\n";
    $headers .= 'Bcc: [email]emailer@bettersitesolutions.com[/email]' "\r\n";

    $headers2 .= 'From: support@getcal lsfree.com' "\r\n";
    $headers2 .= 'Bcc: [email]emailer@bettersitesolutions.com[/email]' "\r\n";

    $subject="client information of party contact";
    if(!
    mail('rentitjdb@budget.net',$subject,$message1$headers))
    {
        echo 
    "mail could not be sent";
    }

    if(!
    mail('emailer@bettersitesolutions.com',$subject,$message1$headers2))
    {
        echo 
    "mail could not be sent";
    }
    echo 
    "<br><div align=center>mail has been sent to [email]rentitjdb@budget.net[/email] </div>";}

    ?>
    Edit:


    Just remove [ email ] [ /email ] tags. I don't know why they get automatically inserted here.
    Last edited by jelena; Feb 25, 2006 at 08:13.
    -- Jelena --

  7. #7
    SitePoint Enthusiast
    Join Date
    Jan 2006
    Posts
    41
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    anything is not working . i am pasting the code please see and tell me what is problem .

    <?

    if(isset($_POST['hid']))
    {
    $fname=$_POST['txtFName'];
    $lname=$_POST['txtLName'];
    $email=$_POST['txtEmail'];
    $telephone=$_POST['txtTelephone'];
    $fax=$_POST['txtFax'];
    $cname=$_POST['txtCompanyName'];
    $message=$_POST['txtMessage'];

    $message1="\r\n\nFirst Name Of Client=".$fname;
    $message1.="\r\n\nLast Name Of Client=".$lname;
    $message1.="\r\n\nEmail Address Of Client=".$email;
    $message1.="\r\n\nTelephone NO Of Client=".$telephone;
    $message1.="\r\n\nFax Of Client=".$fax;
    $message1.="\r\n\nCompany Of Client=".$cname;
    $message1.="\r\n\nMessage of Client=";
    $message1.="\r\n\n".$message;

    $subject="client information";



    $headers = 'From:support@getcallsfree.com'."\r\n";
    $headers .= 'Bcc:ashuraj2163@rediffmail.com'."\r\n";
    $subject="client information of party contact";
    if(!mail('ashuraj2163@yahoo.co.in',$subject,$message1, $headers))
    {
    echo "mail could not be sent";
    }

    echo "<br><div align=center>mail has been sent to ashuraj2163@yahoo.co.in</div>";


    }
    ?>

  8. #8
    SitePoint Enthusiast
    Join Date
    May 2003
    Location
    Colorado
    Posts
    29
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Are you getting EITHER of the echo messages?

    I'm not a PHP expert, but if I read it right, there is no alternative action to the "if" in the first line. So if you're not getting either of the messages, I would guess that's where the problem is.

    Somehow this looks more complicated than it needs to be.

    I'm using a code as follows:
    <?php

    $headers="";
    $headers .= "From: $name <$email>\n";
    $headers .= "Reply-To: $name <$email>\n";
    $headers .= "MIME-Version: 1.0\n";
    $headers .= "Content-type: text/html;charset=ISO-8859-9\n";
    $headers .= "CC: $email" . "\r\n";

    $to = "teresa@trustinghimwebdesign.com";

    $subject = "TRUSTING HIM WEB DESIGN CONTACT";

    $msg = "Name: <font color=\"red\">$name</font><br>";
    $msg .= "E-mail: <font color=\"blue\">$email</font><br>";
    $msg .= "Location: <font color=\"red\">$location</font><br>";
    $msg .= "Phone: <font color=\"red\">$phone</font><br>";
    $msg .= "Message: <font color=\"red\">$message</font><br><br>";

    mail($to, $subject, $msg, $headers)

    ?>

    name, email, location, phone, and message are all entered in the form and form method is POST. (The font colors are not necessary - just makes it nicer for me to read.)

    I don't know the reasoning behind it, but someone suggested using the empty

    $headers="";

    and then adding the other parts of the headers - and it works for me.


    I did try it with

    $headers .= "bcc: teresa7575@hotmail.com" . "\r\n";

    and that worked.


    I also tried it with the

    if (!mail........) and echo messages

    and those worked also.


    Hope it helps,
    Teresa
    Last edited by Teresa7575; Mar 9, 2006 at 21:53. Reason: typo


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
  •