Re: Trouble with sending multipart Email



On Sun, 30 Oct 2005 20:15:30 +1000, Disco Octopus
<discooctopus@xxxxxxxxx> wrote:

>Hi,
>
>I am having a bit of difficulty when sending mail() with multipart.
>
>Under a Windows server, it is working nicely. I am receiving the email
>message in HTML.
>
>Howver, When I run the code under a Unix server the emails I am receiving a
>the entire raw message in the message body of my Outlook client.
>
>Here is the PHP that is running....
>
>
>
> if (empty($to)){
> return(false);
> }
>
> if (empty($from)){
> return(false);
> }
>
> $headers = "";
> $headers .= "From: Speed Queen <$from>\r\n";
> $headers .= "MIME-Version: 1.0\r\n";
> $headers .= "To: $toname <$to>\r\n";
> $headers .= "Reply-To: $from\r\n";
> $headers .= "X-Mailer: PHP" . "phpversion()\r\n";
> $headers .= "X-Sender: $from\r\n";
> $headers .= "Return-Path: $from\r\n";
> $headers .= "Content-Type: multipart/alternative;
>boundary=$boundary\r\n\r\n";
>
> //message to people with clients who don't
> //understand MIME
> $headers .= "This is a MIME encoded message\r\n\r\n";
>
> $body = "";
> //plain text version of message
> $body .= "--$boundary\r\n";
> $body .= "Content-Type: text/plain; charset=ISO-8859-1\r\n";
> $body .= "Content-Transfer-Encoding: 8bit\r\n\r\n";
> $body .= $body_plain;
>
> //HTML version of message
> $body .= "--$boundary\r\n";
> $body .= "Content-Type: text/html; charset=ISO-8859-1\r\n";
> $body .= "Content-Transfer-Encoding: 8bit\r\n\r\n";
> $body .= $body_html;
>
> $body .= "\r\n";
>
> return (mail($to, $subject, $body, $headers));
>
>
>
>Can anyone see anyting in here that could be made "nicer" or that would be
>a reason why when run on a different server, different results are seen?
>
>Thanks

Multipart emails should have the entire message in the header, at
least that is the way I have always done it. Your closing boundary
should be at the end of the content.

Compare the structure of your email against one that you know that is
properly interpreted by the email client.

.



Relevant Pages

  • fax receiving problems
    ... I'm having a problem with a fax server at one of my client ... I recently installed the SBS 2003 fax server feature with a brand new ... Receiving is a little more tricky. ... see Help and Support Center at ...
    (microsoft.public.windows.server.sbs)
  • Error during delivery process
    ... A client of ours kept on receiving the same message over and over again. ... below from our own mail server: ... The following errors occurred during message delivery processing: ...
    (microsoft.public.exchange2000.admin)
  • Kerberos Error Message
    ... your client date indicates as 9/9/2004. ... on both server and clients are synchronized...? ... >I'm receiveing a kerberos error every few hours (The ... >Does anybody know why I'm receiving this error or where I ...
    (microsoft.public.win2000.security)
  • Re: Segmented Data Over Sockets
    ... Just as others explained, if you sendN bytes from the client, it does not ... mean that a single corresponding recv() on the server will receive N bytes. ... each byte of the local structure on the receiving end, ...
    (microsoft.public.win32.programmer.networks)
  • Re: System.WebException | The operation has timed out
    ... it is webserver that has timed out. ... But the error I am receiving is at ... When web server times out, the error received by the client is "The ...
    (microsoft.public.dotnet.framework.aspnet)