Connecting Tech Pros Worldwide Help | Site Map

Apple Mail sees attachment in generated email but cannot open

 
LinkBack Thread Tools Search this Thread
  #1  
Old March 24th, 2008, 06:45 PM
jerrygarciuh
Guest
 
Posts: n/a
Default Apple Mail sees attachment in generated email but cannot open

Hi folks,

I have a PHP cron job that compiles a CSV from queries and emails it
to some clients. I have a complaint that one client can see the
indicating icon to say there is an attachment in his Apple Mail but
attempts to open it fail. If he forwards the email to Gmail he can
open the attachment from there so it is a mail client issue, not a
file issue.

This sounds to me like maybe the boundaries I am setting have issues?
Anyone have experience or ideas about a fix? Here is the offending
function.

TIA!

JG


function sendAttachment($csvName, $message, $emails) {
$csv = implode('', file("reports/$csvName.csv"));
$date = date( 'r' );
$phpversion = phpversion();
$boundary = md5( time() );
$filename = "$csvName.csv";
$headers = <<<END
From: myaddress@cox.net
Reply-To: myaddress@cox.net
Return=Path: myaddress@cox.net
Date: $date
X-Mailer: PHP v$phpversion
MIME-Version: 1.0
Content-Type: multipart/related; boundary="$boundary"
END;

$message = <<<END
--$boundary
Content-Type: text/plain; charset="iso-9959-1"
Content-Transfer-Encoding: 7bit

$message

--$boundary
Content-Type: octet-stream; name="$filename"
Content-Disposition: attachment; filename="$filename"
Content-Transfer-Encoding: 7bit

$csv

--$boundary--

END;

return mail( join($emails, ','), $csvName, $message, $headers );
} // func

  #2  
Old March 24th, 2008, 07:05 PM
jerrygarciuh
Guest
 
Posts: n/a
Default Re: Apple Mail sees attachment in generated email but cannot open

On Mar 24, 1:42 pm, jerrygarciuh <jerrygarc...@gmail.comwrote:
Quote:
Hi folks,
>
I have a PHP cron job that compiles a CSV from queries and emails it
to some clients. I have a complaint that one client can see the
indicating icon to say there is an attachment in his Apple Mail but
attempts to open it fail. If he forwards the email to Gmail he can
open the attachment from there so it is a mail client issue, not a
file issue.
>
This sounds to me like maybe the boundaries I am setting have issues?
Anyone have experience or ideas about a fix? Here is the offending
function.
>
TIA!
>
JG
>
function sendAttachment($csvName, $message, $emails) {
$csv = implode('', file("reports/$csvName.csv"));
$date = date( 'r' );
$phpversion = phpversion();
$boundary = md5( time() );
$filename = "$csvName.csv";
$headers = <<<END
From: myaddr...@cox.net
Reply-To: myaddr...@cox.net
Return=Path: myaddr...@cox.net
Date: $date
X-Mailer: PHP v$phpversion
MIME-Version: 1.0
Content-Type: multipart/related; boundary="$boundary"
END;
>
$message = <<<END
--$boundary
Content-Type: text/plain; charset="iso-9959-1"
Content-Transfer-Encoding: 7bit
>
$message
>
--$boundary
Content-Type: octet-stream; name="$filename"
Content-Disposition: attachment; filename="$filename"
Content-Transfer-Encoding: 7bit
>
$csv
>
--$boundary--
>
END;
>
return mail( join($emails, ','), $csvName, $message, $headers );
>
} // func

Solved! Replaced:

Content-Type: multipart/related; boundary="$boundary"

With:

Content-Type: multipart/mixed; boundary="$boundary"

Peace,

JG
 

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Popular Articles

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over 220,989 network members.