Toon posts:

[ASP] HTML mail en attachments

Pagina: 1
Acties:

Verwijderd

Topicstarter
Als mailcomponent gebruik ik ASPmail 4.x (serverobjects.com)

Ik wil met asp een HTML mailtje versturen met attachment.

Normaal gebruik je ContentType = "text/html" en dan laat outlook netjes de html zien.

Op het moment dat er een attachment meegestuurd wordt dan veranderd de Contenttype in multipart/mixed;

en je raadt het al... geen html opmaak meer .. maar de source.

zonder attachment werkt alles zonder problemen.

Is het gewoon niet mogelijk om zowel HTML als attachments tegelijk te versturen .. of heb ik iets gemist.

  • Gert
  • Registratie: Juni 1999
  • Laatst online: 05-12-2025
Dit gebruiken ze in een voorbeeld mailtje. :)
code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
BOUNDARY    = "----xxxxxx"
  TEXT_HEADER = "--" & BOUNDARY & VBCrLf & "Content-Type: text/plain;" & VBCrLf & _
            "Content-Transfer-Encoding: 7bit" & VBCrLf & VBCrLf
  HTML_HEADER = "--" & BOUNDARY & VBCrLf & "Content-Type: text/html;" & VBCrLf & _
            "Content-Transfer-Encoding: 7bit" & VBCrLf & VBCrLf
  MP_FOOTER   = "--" & BOUNDARY & "--" & VBCrLf
strTextBody = "Here's the information you requested in text format..." & VBCrLf & _
            "Cordially," & VBCrLf & "The Management"
strHTMLBody = "<html><head><title>The Information You Requested</title></head>" & _
            "<body bgcolor=""Black"" text=""Yellow"" link=""#0000FF"" vlink=""#800080"">" & _
            "<font face=""Arial""><b>Here's the information you requested in HTML format..." & _
            "</body></html>"
strBody = TEXT_HEADER & strTextBody & VBCrLf & HTML_HEADER & strHTMLBody & VBCrLf & MP_FOOTER
...
 Mailer.ContentType = "multipart/alternative; boundary=""" & BOUNDARY & """"
  Mailer.BodyText = strBody

Denk dat je hier wel wat aan hebt, gewoon het geheel in 2 stukken hakken. :)

Verwijderd

werkt dit ook met aspmail 3.0?
Ik had het zelfde probleem en ik krijg het niet voor elkaar.

  • TweakersOnly
  • Registratie: September 2000
  • Laatst online: 00:30
Helaas, ASPMail kan niet overweg met zowel HTML als attachments. Ik heb er een tijdje terug ook problemen mee gehad, maar het is niet mogelijk. Het staat ook bij de handleiding van ASPMail.