Home   Archive   Permalink



Sending HTML email with attachment

I can send email in HTML format using this code:
    
R E B O L [
    title "sending HTML email"
]
myheader: make object! [
    Content-Type: "text/html"
    From: reboller@hotmail.com
    Return-Path: reboller@hotmail.com
    To: "REBollers"
    Date: to-idate now
    MIME-Version: "1.0"
]
send/header reboller@hotmail.com "Testing sending" myheader
halt
    
And I can send attachment using this code:
    
R E B O L [
    title "sending HTML email with attachment"
]
myheader: make object! [
    Content-Type: "text/html"
    From: reboller@hotmail.com
    Return-Path: reboller@hotmail.com
    To: "REBollers"
    Date: to-idate now
    MIME-Version: "1.0"
]
send/header/attach reboller@hotmail.com "Testing sending" myheader %picture.jpeg
halt
    
But when I send the email with attacment, the email did not came in HTML format. Why not?
    
Look: http://www.petke.info/sending.html

posted by:   Petri Keckman     15-Jun-2013/22:53:01-7:00



I've faced this problem too,
There is a kind of bug in build-attach-body function which is used in sending email with attachment.
    
     >> source build-attach-body
    
You can see that it switches to text/plain when you have an attachment:
    
     ...
     insert body reduce [boundary "^/Content-type: text/plain^/^/"]
     ..
    
you can copy build-attach-body function source into your rebol.r file and change that line to text/html to make the html format default.
    
I hope this will help.


posted by:   Endo     5-Aug-2013/17:40:07-7:00