473,394 Members | 1,770 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

mime multipart shows up as attachment

Hi!

I wrote a little function to send emails which works quite well. I already
managed to send attachments correctly (also more than 1 per email) but I am
not able to send a HTML mail containing a text only block for non-HTML
clients. I will not post the PHP code as I think it is irrelevant, the error
lies within the mail header and/or body, so here is the mail I do want to
send:

FROM: me <fo*@bar.com>
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="MIME_BOUNDARY"
--MIME_BOUNDARY
Content-Type: text/plain; charset="iso-8859-1"
Content-Transfer-Encoding: 8bit

This is a multi-part message in MIME format.
navision://client/run?etcetc

--MIME_BOUNDARY
Content-Type: text/html; charset="iso-8859-1"
Content-Transfer-Encoding: 8bit

<html><body>
<a href="navision://client/run?etcetc">click me</a>
</body></html>

--MIME_BOUNDARY--

The first 3 lines are passed as the header to PHP's mail() function, whereas
the rest is passed as the body (starting with the first --MIME_BOUNDARY
line). If I send a mail this way I get the mail with the text/plain part
displayed and an ATT<random#>.html attachment containing the text/html part.

What exactly am I doing wrong?

Thank you!
Klaus.
Aug 1 '06 #1
2 5009
*** Der tolle Emil escribió/wrote (Tue, 1 Aug 2006 13:54:28 +0200):
FROM: me <fo*@bar.com>
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="MIME_BOUNDARY"
Try: multipart/alternative
--MIME_BOUNDARY
This --MIME_BOUNDARY should not be here.
Content-Type: text/plain; charset="iso-8859-1"
Content-Transfer-Encoding: 8bit

This is a multi-part message in MIME format.
navision://client/run?etcetc
This stuff is supposed to provide a hint for MIME unaware clients. It's not
where you put your text only version: MIME away clients will ignore it.

So you need an additional block for your plain text.
>
--MIME_BOUNDARY
Content-Type: text/html; charset="iso-8859-1"
Content-Transfer-Encoding: 8bit

<html><body>
<a href="navision://client/run?etcetc">click me</a>
</body></html>

--MIME_BOUNDARY--
This is a message generated by The Bat! mail client, use it as template:
Date: Tue, 1 Aug 2006 19:48:29 +0200
From: "Alvaro G. Vicario" <alvaro@*************>
X-Mailer: The Bat! (v2.01.3) Personal
Organization: http://www.demogracia.com/
X-Priority: 3 (Normal)
Message-ID: <12***********************@demogracia.com>
To: Alvaro G Vicario <alvaro@*************>
Subject: Mixed HTML and text
MIME-Version: 1.0
Content-Type: multipart/alternative;
boundary="----------1271226D31E3D293"

------------1271226D31E3D293
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

This is the message body.
------------1271226D31E3D293
Content-Type: text/html; charset=us-ascii
Content-Transfer-Encoding: 8bit

<html><head>
</head>
<body BGCOLOR=#D2C1EC>
This is the <b>message</bbody. </body></html>
------------1271226D31E3D293--
--
-+ http://alvaro.es - Álvaro G. Vicario - Burgos, Spain
++ Mi sitio sobre programación web: http://bits.demogracia.com
+- Mi web de humor con rayos UVA: http://www.demogracia.com
--
Aug 1 '06 #2

"Alvaro G. Vicario" <we*******@NOSPAMdemogracia.comschrieb im Newsbeitrag
news:q9*****************************@40tude.net...
*** Der tolle Emil escribió/wrote (Tue, 1 Aug 2006 13:54:28 +0200):
>FROM: me <fo*@bar.com>
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="MIME_BOUNDARY"

Try: multipart/alternative
>--MIME_BOUNDARY

This --MIME_BOUNDARY should not be here.
>Content-Type: text/plain; charset="iso-8859-1"
Content-Transfer-Encoding: 8bit

This is a multi-part message in MIME format.
navision://client/run?etcetc

This stuff is supposed to provide a hint for MIME unaware clients. It's
not
where you put your text only version: MIME away clients will ignore it.

So you need an additional block for your plain text.
>>
--MIME_BOUNDARY
Content-Type: text/html; charset="iso-8859-1"
Content-Transfer-Encoding: 8bit

<html><body>
<a href="navision://client/run?etcetc">click me</a>
</body></html>

--MIME_BOUNDARY--

This is a message generated by The Bat! mail client, use it as template:
Date: Tue, 1 Aug 2006 19:48:29 +0200
From: "Alvaro G. Vicario" <alvaro@*************>
X-Mailer: The Bat! (v2.01.3) Personal
Organization: http://www.demogracia.com/
X-Priority: 3 (Normal)
Message-ID: <12***********************@demogracia.com>
To: Alvaro G Vicario <alvaro@*************>
Subject: Mixed HTML and text
MIME-Version: 1.0
Content-Type: multipart/alternative;
boundary="----------1271226D31E3D293"

------------1271226D31E3D293
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

This is the message body.
------------1271226D31E3D293
Content-Type: text/html; charset=us-ascii
Content-Transfer-Encoding: 8bit

<html><head>
</head>
<body BGCOLOR=#D2C1EC>
This is the <b>message</bbody. </body></html>
------------1271226D31E3D293--
--
-+ http://alvaro.es - Álvaro G. Vicario - Burgos, Spain
++ Mi sitio sobre programación web: http://bits.demogracia.com
+- Mi web de humor con rayos UVA: http://www.demogracia.com
--

Thanks! That did it; I believe I tried multipart/alternative before but then
changed it back because obviously I had another error and thus thought that
it made no difference.
Aug 2 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: fishboy | last post by:
Howdy, Sorry if this is a double post. First try seemed to go into hyperspace. I'm working on a personal project. It's going to be a multipart binary attachment downloader that will search...
0
by: Guoqi Zheng | last post by:
Dear sir, I am using my own tcpclient code to send email instead of using CDO. Question, I would like the mail message to be in mime multipart format. I am not familiar with mime. Does any...
0
by: Pol | last post by:
I am using the imap_* routines to download mail form a pop server. I want to only process the text/plain section of some messages and text/html section of other messages. How may I separate these...
0
by: andreas.baus | last post by:
Hello. I'm trying to build a client using .NET/C# that is capable of communicating with an existing Webservice written in Java using Apache Axis. Now, I've encountered a problem trying to...
0
by: sachintandon | last post by:
Hello all, Thanks in advance for your help I have a problem in sending emails, my requirement is to send multipart alternative emails with attachments, I'm able to send text with attachments or...
1
by: Gabriel Genellina | last post by:
En Fri, 29 Aug 2008 14:41:53 -0300, Ron Brennan <brennan.ron@gmail.com> escribi�: What is a "multipart"? I know MIME multipart messages but they don't seem to apply here... From your other...
1
by: deepaks85 | last post by:
Dear All, I want to send some data through a form with Multiple attachment in an HTML Format. I have tried it but it is not working for me. I am able to send data without attachment but with the...
5
by: xmaverick | last post by:
Hello, I'm a newbie to perl and i'd like some assistance trying to figure out how to send an attachment using MIME::Lite. I have searched the net far and wide and have used and modify different...
1
by: scorpio22 | last post by:
hi, I am trying to create a web service in VS 2005 using C#. I want to retrieve an attachment that i can use in the webservice and then send another attachment as a response from the same...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.