Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • How to send mail with multiple CC using PHP

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 8.73k
    Comment on it

    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 and string with coma separated cc emails:-
    $cc = 'abc@gmail.com,zye@yahoo.com.test@gmail.com';
    
    Secon create and string with coma separated bcc emails:-
    $cc = 'bcc@gmail.com,testingbcc@yahoo.com.test30@gmail.com';
    

    you can put your simple mail function and address the cc and bcc.

    $recipients = "$email";
        $headers["From"] = "$from";
        $headers["To"] = "$email";
        $headers["Subject"] = $subject;
        $headers["Cc"] = "$cc";  //custom line and $cc is defined above
        $headers["Bcc"] = "$bcc";   //custom line and $cc is defined above
    
    
        //$mailmsg = "Welcome to Addatareference.com! \r\n\r\nBelow is your unique login information.  \r\n\r\n(Please do not share your login information.)$accountinfo";
        /* SMTP server name, port, user/passwd */
        $smtpinfo["host"] = "smtp.emailsrvr.com";
        $smtpinfo["port"] = "25";
        $smtpinfo["auth"] = true;
        $smtpinfo["username"] = "$from";
        $smtpinfo["password"] = "$emailpass";
        /* Create the mail object using the Mail::factory method */
        $mail_object =& Mail::factory("smtp", $smtpinfo);
    

    Now when this will calll the mails will send to them.

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: