freephoneid Posted February 17, 2009 Share Posted February 17, 2009 Hi, I'm usign PHP 5.2 & using following code for sending email function PasswordNotify($Email, $Password, $Login, $Type) { $Subject = gettext("pwd notify subject"); $messagebody = base64_encode("Test Message goes here"); $messageheaders = "Return-Path: [email protected]\n" . "Content-Type: text/plain; charset=\"utf-8\"\n" . "Content-Transfer-Encoding: base64\n" . "Reply-to: [email protected]\n" . "From: My Services <[email protected]>"; return mail($Email, $Subject, $messagebody, $messageheaders); } One of my common files sets the following code, since its language specific... putenv("LANG=$Language"); bindtextdomain("messages", "./locale"); bind_textdomain_codeset("messages", "UTF-8"); textdomain("messages"); if ($Language == 'en') { setlocale(LC_ALL,'en_US'); } else if ($Language == 'ja') { setlocale(LC_ALL,'ja_JP.utf8'); } else if ($Language == 'de') { setlocale(LC_ALL,'de_DE'); } However, when the email is sent, it goes fine to everyone except for gmail & Mac users who use exchange server connected to MS Entourage in Mac. Gmail users receives email with empty body but the subject appears fine. And the Mac users receive it priperly but with some characters cut-off within the body, they've some character limit, last limits gets cut off for Mac users. Can anyone tell me how to resolve these 2 issues? Appreciate your help!! Thanks! Quote Link to comment https://forums.phpfreaks.com/topic/145628-email-body-empty-in-gmail-body-gets-cut-off-in-mac-exchange-server/ Share on other sites More sharing options...
mbeals Posted February 17, 2009 Share Posted February 17, 2009 my guess is something with the encoding. Try sending the mail with the body as plain text (ditch the base64_encode) and just see if it fixes the problem. Quote Link to comment https://forums.phpfreaks.com/topic/145628-email-body-empty-in-gmail-body-gets-cut-off-in-mac-exchange-server/#findComment-764537 Share on other sites More sharing options...
freephoneid Posted February 17, 2009 Author Share Posted February 17, 2009 then the email comes with junk characters.... any suggestion? Quote Link to comment https://forums.phpfreaks.com/topic/145628-email-body-empty-in-gmail-body-gets-cut-off-in-mac-exchange-server/#findComment-764540 Share on other sites More sharing options...
mbeals Posted February 17, 2009 Share Posted February 17, 2009 did you take "Content-Transfer-Encoding: base64" out of the header too? poking around, I found two things that may be important here: 1. there is a limit on email line length (70 chars). So be sure to: $body = chunk_split( base64_encode( $body ) ); or $body = word_wrap($body,70); 2. I found issues with sending utf-8 encoded mail with mail(). Possibly remove that from the header. 3. I found numerous issues with gmail compatibility and lots of different 'tricks' browse through the comments in the man entry: http://us2.php.net/manual/en/function.mail.php that and googleing 'php mail() gmail' turned up a lot. good luck Quote Link to comment https://forums.phpfreaks.com/topic/145628-email-body-empty-in-gmail-body-gets-cut-off-in-mac-exchange-server/#findComment-764555 Share on other sites More sharing options...
freephoneid Posted February 18, 2009 Author Share Posted February 18, 2009 Hi, Thanks for your kind reply!!! chunkk_split resolved my issue with at least missing body!!!!!!! I've one more question... Usign this same code, if I add dynamic variable as shown below which contains more than 7000 comma separated email address, will it work? Will the email be sent to all 7000 ppl? function PasswordNotify($Email, $Password, $Login, $Type) { $morecustomers = GetEmail(); // contains more than 7000 comma separated email. $Subject = gettext("pwd notify subject"); $messagebody = base64_encode("Test Message goes here"); $messageheaders = "Return-Path: [email protected]\n" . "Content-Type: text/plain; charset=\"utf-8\"\n" . "Content-Transfer-Encoding: base64\n" . "Reply-to: [email protected]\n" . "From: My Services <[email protected]>\n" . "Bcc: $morecustomers"; return mail($Email, $Subject, $messagebody, $messageheaders); } Thanks! Quote Link to comment https://forums.phpfreaks.com/topic/145628-email-body-empty-in-gmail-body-gets-cut-off-in-mac-exchange-server/#findComment-764702 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.