|
Source code samples |
|
The following source code samples demonstrate how easy it is to send an email using MailMill
COM.
The code is written in VBScript but could be in any other
programming languages. |
|
Simple text message |
Dim oMail
Set oMail = CreateObject("MailMill.Mail")
oMail.From = "John
<john@emilltest.com>"
oMail.Tos.Add "Brian
<brian@emilltest.com>"
oMail.Subject = "A very simple mail"
oMail.TextBody = "Hello World!"
oMail.Server = "smtp.mydomain.tld"
oMail.Send
Set oMail = Nothing |
|
HTML message with embedded images
|
Dim oMail
Set oMail = CreateObject("MailMill.Mail")
oMail.From = "Lisa <lisa@emilltest.com>"
oMail.Tos.Add "Bernard
<bernard@emilltest.com>"
oMail.Subject = "An HTML mail that contains images"
oMail.HtmlBody = "<html><body>Hello <img src=c:\images\world.gif></body></html>"
oMail.TextBody = "Hello World!" ' optional alternate text
oMail.Server = "smtp.mydomain.tld"
oMail.Send
Set oMail = Nothing
' The local image will automatically be embedded in the MIME. |
|
Text message with a static attachment
|
Dim oMail
Set oMail = CreateObject("MailMill.Mail")
oMail.From = "John <john@emilltest.com>"
oMail.Tos.Add "Brian
<brian@emilltest.com>"
oMail.Subject = "A mail with an attachment"
oMail.TextBody = "Please find attached your invoice"
oMail.Attachments.Add "c:\invoices\invoice.pdf"
oMail.Server = "smtp.mydomain.tld"
oMail.Send
Set oMail = Nothing |
|
Text message with a dynamic attachment
|
Dim oMail, oAttach
Set oMail = CreateObject("MailMill.Mail")
oMail.From = "John <john@emilltest.com>"
oMail.Tos.Add "Caroline
<caroline@emilltest.com>"
oMail.Subject = "A mail with an attachment"
oMail.TextBody = "Please find attached your monthly commission report"
Set oAttach = CreateObject("MailMill.Attachment")
oAttach.Name = Year() & "-" & Month() & "-comission.txt"
oAttach.Type = "text/plain"
oAttach.Data = "This month your will receive a commission of
$7,589.78." & vbCrLf & "Keep up the good work."
oMail.Attachments.Add oAttach
oMail.Server = "smtp.mydomain.tld"
oMail.Send
Set oMail = Nothing
Set oAttach = Nothing |