PHP Mail, CC Field

php mail cc multiple recipients
php mail multiple recipients
php mail bcc
php mail not working
php mail = $smtp
how to send html table in email body in php
php mail from address
php mail configuration

How can I include a CC field in this function?

function mail_attachment($filename, $path, $mailto, $from_mail, $from_name, $replyto, $subject, $message) {
    $file = $path.$filename;
    $file_size = filesize($file);
    $handle = fopen($file, "r");
    $content = fread($handle, $file_size);
    $content = chunk_split(base64_encode($content));
    $uid = md5(uniqid(time()));
    $name = basename($file);
    $header = "From: ".$from_name." <".$from_mail.">\r\n";
    $header .= "Reply-To: ".$replyto."\r\n";
    $header .= "MIME-Version: 1.0\r\n";
    $header .= "Content-Type: multipart/mixed; boundary=\"".$uid."\"\r\n\r\n";
    $header .= "This is a multi-part message in MIME format.\r\n";
    $header .= "--".$uid."\r\n";
    $header .= "Content-Type: text/html; charset=iso-8859-1\n";
    $header .= "Content-Transfer-Encoding: 7bit\r\n\r\n";
    $header .= $message."\r\n\r\n";
    $header .= "--".$uid."\r\n";
    $header .= "Content-Type: application/octet-stream; name=\"".$filename."\"\r\n"; // use different content types here
    $header .= "Content-Transfer-Encoding: base64\r\n";
    $header .= "Content-Disposition: attachment; filename=\"".$filename."\"\r\n\r\n";
    $header .= $content."\r\n\r\n";
    $header .= "--".$uid."--";
    if (mail($mailto, $subject, "", $header)) {
        echo  "OK"; // or use booleans here
    } else {
        echo  "ERROR!";

Add this while declaring headers:

$headers .= 'Cc:' . "\r\n";

PHP Mail, CC Field, Add this while declaring headers: $headers .= 'Cc:' . "\r\ n";. 1) The domain in the email used in the -f option in the php.ini sendmail parameter or in the mail() extra parameters field, needs to have a valid SPF record for the domain (in DNS as a "TXT" record type for sure and add an additional "SPF" type record if possible).

Add $header .= "CC: ".$cc."\r\n"; after the Reply-To-line.

mail - Manual, This is typically used to add extra headers (From, Cc, and Bcc). in the php.ini sendmail parameter or in the mail() extra parameters field, needs to have a valid � The Cc field will show as blank, but as long as you have a “cc” column in your spreadsheet, each email message will be Cc’d to the address from the spreadsheet. The “Cc” field in the Gmail Compose window will remain blank. Similarly, you can set a personalized Bcc address by creating a column called “bcc” in your spreadsheet.

Please don't build your own MIME emails. Use something like PHPMailer instead. Far easier to use and less brittle. Adding a CC with that is as simple as:

$mail = new PHPMailer();

Complete php mail() script with To, ReplyTo, CC, BCC and , Leave a Reply Cancel reply. Your email address will not be published. Required fields are marked *. Comment. Name� Everyone listed under the CC field will see everyone’s email address that are listed under the To and CC field but will not see the addresses listed in the BCC field. Each person listed on the BCC field will not see the email addresses of other recipients. Reasons you would use CC and BCC.

PHP mail() Function, PHP mail is the built in PHP function that is used to send emails from PHP scripts. Email address; Subject; Message; CC or BC email addresses “ SANITIZATION TYPE” is the type of sanitization to be performed on the field such as;. PHP Mail, CC Field. Ask Question Asked 9 years, 11 months ago. Active 1 year, 3 months ago. Viewed 78k times 23. 5. How can I include a CC field in this function?

How to Send Email using PHP mail() Function, Hello reader's! if you want to send the mail to multiple cc or bcc then you just have to put the emails separated by coma. lets see the example below:-first create� Cc is short for carbon copy. Before mail went digital, carbon copy paper made it possible to send the same letter to two people without having to write or type it twice. When an email address is entered in the Cc field, that person receives a copy of the message sent to the person in the To field.

How to send mail with multiple CC using PHP, If the email address in the "TO" field is also set in email action as CC or BCC then the send fails, with "PHP mail" or "Sendmail" configured. Please do as follow to add cc or bcc field in mailto function. 1. Select the cell with the text you want to add mailto hyperlink. 2. Click Insert > Hyperlink. 3. In the Insert Hyperlink dialog box, you need to: 1). Click E-mail Address in the Link to pane; 2). Enter the To recipient address in the E-mail address box; 3).

  • Either one of the answers will do...have you considered using a library (phpmailer, swiftmailer, pear::mail, etc...) to make your life easier?