Jump to content

Email body empty in Gmail & body gets cut off in Mac exchange server


freephoneid

Recommended Posts

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: xxx@xxx.com\n" .
"Content-Type: text/plain; charset=\"utf-8\"\n" .
"Content-Transfer-Encoding: base64\n" .
"Reply-to: xxx@xxx.com\n" .
"From: My Services <xxx@xxx.com>";

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!

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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: xxx@xxx.com\n" .
"Content-Type: text/plain; charset=\"utf-8\"\n" .
"Content-Transfer-Encoding: base64\n" .
"Reply-to: xxx@xxx.com\n" .
"From: My Services <xxx@xxx.com>\n" .
             "Bcc: $morecustomers";

return mail($Email, $Subject, $messagebody, $messageheaders);
}

 

Thanks!

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.