shadiadiph Posted January 23, 2009 Share Posted January 23, 2009 How can i add a bcc section to this sendmail code? $to = "$emailclient"; $subject = "$subj"; $MsgHeader = "From: COMPANY NAME. <info@company.com> \n"; $MsgHeader .= "MIME-Version: 1.0\n"; $MsgHeader .= "Content-type: text/html; charset=iso-8859-1"; $MsgBody = " <html> <head> <title>HTML message</title> </head> <body> hello </body> </html>"; mail($to, $subject, $MsgBody, $MsgHeader); Quote Link to comment Share on other sites More sharing options...
uniflare Posted January 23, 2009 Share Posted January 23, 2009 PHP.net is our best friend: http://uk2.php.net/function.mail but basically: $MsgHeader .= 'Cc: birthdayarchive@example.com' . "\r\n"; $MsgHeader .= 'Bcc: birthdaycheck@example.com' . "\r\n"; Quote Link to comment Share on other sites More sharing options...
shadiadiph Posted January 23, 2009 Author Share Posted January 23, 2009 thanks Quote Link to comment Share on other sites More sharing options...
shadiadiph Posted January 23, 2009 Author Share Posted January 23, 2009 mm i have been using things from php.net the examples do not seem to work the one i have been using is like this it works some of the time but not all the time 50-50 sometimes people don't get my emails? $to = "<support@company.com>"; $subject = "Test"; $MsgHeader = "From: COMPANY NAME. <info@worldatrading.com> \n"; $MsgHeader .= "Bcc: <$emailadvisor> \n"; $MsgHeader .= "MIME-Version: 1.0\n"; $MsgHeader .= "Content-type: text/html; charset=iso-8859-1"; $MsgBody = " <html> <head> <title>HTML message</title> </head> <body> hello </body> </html>"; mail($to, $subject, $MsgBody, $MsgHeader); does anyone have one that works 99% of the time? Quote Link to comment Share on other sites More sharing options...
uniflare Posted January 23, 2009 Share Posted January 23, 2009 Hmm, if you mean by 50% of the people you send it to recieve it 100% of the time, then it may be compatiblity issues, try using CC: instead of BCC. If, however you mean 100% of the people only get it 50% of the time, then im not so sure its php's fault, i've only developed on a windows machine so i couldnt help you with sendmail. unless your using SMTP, especially free smtp servers can be very frustrating on a development machine. Quote Link to comment Share on other sites More sharing options...
shadiadiph Posted January 23, 2009 Author Share Posted January 23, 2009 i mean out of 100 emails i send only 50 arrive Quote Link to comment Share on other sites More sharing options...
uniflare Posted January 23, 2009 Share Posted January 23, 2009 ya, but is it the same people that dont get the mail? or random? did u try the suggestion? Quote Link to comment Share on other sites More sharing options...
shadiadiph Posted January 23, 2009 Author Share Posted January 23, 2009 yes it made no difference Quote Link to comment Share on other sites More sharing options...
uniflare Posted January 23, 2009 Share Posted January 23, 2009 hmm, try on another machine. apart from that; you might want to look into the PEAR Mail Library. one last suggestion would be to look into extra Headers you can send, eg x-mailer etc; Quote Link to comment Share on other sites More sharing options...
shadiadiph Posted January 23, 2009 Author Share Posted January 23, 2009 thanks i will have a look i seem to have go it working now by using $MsgHeader .= "Bcc: $email r\n"; Quote Link to comment Share on other sites More sharing options...
uniflare Posted January 23, 2009 Share Posted January 23, 2009 ah yes, \r\n this is for windows systems, \r for mac and \n for *nix. Quote Link to comment Share on other sites More sharing options...
dvd420 Posted January 23, 2009 Share Posted January 23, 2009 Hi, The mail() function is PHP just triggers the mail, it never bothers about its delivery. If you are interested in writing few extra lines of PHP, use PHPMailer class. Quote Link to comment Share on other sites More sharing options...
shadiadiph Posted January 23, 2009 Author Share Posted January 23, 2009 thanks i am looking online for it now it might come in useful as at the moment i am trying to build a newsletter Quote Link to comment Share on other sites More sharing options...
uniflare Posted January 23, 2009 Share Posted January 23, 2009 Mail is *not* reccommended for Large news groups; Alternatives to the Sendmail program: (nothing to do with php) qMail Postfix Alternatives to mail() function: (everything to do with php) PEAR::Mail - http://www.hudzilla.org/phpbook/read.php/15_5_2 PHP Mailer Class - http://phpmailer.codeworxtech.com/ The PHP Mailer class is a giant mail classfile that is there to make our life easier - it cotains pretty much all the functions you will ever need with mailing. PEAR::Mail; PEAR's Mail package defines an interface for implementing mailers under the PEAR hierarchy. It also provides supporting functions useful to multiple mailer backends. Currently supported backends include: PHP's native mail() function, sendmail, and SMTP. This package also provides a RFC822 email address list validation utility class. Quote Link to comment Share on other sites More sharing options...
shadiadiph Posted January 23, 2009 Author Share Posted January 23, 2009 thank you i will have a look later on when i have completed what i am doing right now Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.