// MM
New MM
Set MM=##class(%Net.MailMessage).%New()
Set MM.From="Cache
"
Do MM.To.Insert("tr@vanhoecke.be")
Do MM.To.Insert("likemurder@gmail.com")
Set MM.Subject="Embedded mail via Cache"
Set MM.ContentType="multipart/related"
Do MM.Headers.SetAt("multipart/alternative","Type")
// MM.ALT
New AltPart
Set AltPart=MM.AttachNewMessage()
Set AltPart.ContentType="multipart/alternative"
// MM.ALT.TEXT
New TextPart
Set TextPart=AltPart.AttachNewMessage()
Set TextPart.ContentType="text/plain"
Do TextPart.TextData.WriteLine("Nieuwsbrief Van Hoecke")
// MM.ALT.HTML
New HTMLPart
Set HTMLPart=AltPart.AttachNewMessage()
Set HTMLPart.ContentType="text/html"
New tmpStream,Line
Set tmpStream=##class(%FileCharacterStream).%New()
Set tmpStream.Filename="\\notes01\datatr\Temp\infomails 06\embedded4.htm"
For Quit:(tmpStream.AtEnd) Do
. Set Line=tmpStream.ReadLine()
. Do HTMLPart.TextData.WriteLine(Line)
// MM.IMGs
New Imgs,ImgPart,ImgName,Status
Set Imgs=$LB("ORGALUXlogo.gif","LijnRoodboven.gif","01Beurs06.jpg","DS_iconen.jpg","06Beurs06.jpg","02Beurs06.jpg","07Beurs06.jpg","LijnRoodonder.gif")
For Loop=1:1:$LL(Imgs) Do
. Set ImgName=$LI(Imgs,Loop)
. Set ImgPart=MM.AttachNewMessage()
. Set ImgPart.IsBinary=1
. Set ImgPart.IsBase64=1
. If $P(ImgName,".",2)="gif" Do
.. Set ImgPart.ContentType="image/gif"
. Else Do
.. Set ImgPart.ContentType="image/jpeg"
. Set Status=ImgPart.BinaryData.LinkToFile("\\notes01\datatr\Temp\infomails 06\"_ImgName)
. Quit:(Status'=1)
. Quit:(ImgPart.BinaryData.AtEnd)
. Do ImgPart.Headers.SetAt("inline","Content-Disposition")
. Do ImgPart.Headers.SetAt($P(ImgName,".",1),"Content-ID")
. //Do ImgPart.Headers.SetAt(ImgName,"name")
. //Do ImgPart.Headers.SetAt(ImgName,"filename")
New SMTP
Set SMTP=##class(%Net.vhSMTP).%New()
Set SMTP.smtpserver="Notes01"
w "Send: "_$$ParseStatus^vhLib(SMTP.Send(MM))
Quit
// MM
New MM
Set MM=##class(%Net.MailMessage).%New()
Set MM.From="Cache
"
Do MM.To.Insert("tr@vanhoecke.be")
Do MM.To.Insert("likemurder@gmail.com")
Set MM.Subject="Embedded mail via Cache"
Set MM.ContentType="multipart/related"
// MM.REL
New RelPart
Set RelPart=MM.AttachNewMessage()
Set RelPart.ContentType="multipart/related"
// MM.REL.ALT
New AltPart
Set AltPart=RelPart.AttachNewMessage()
Set AltPart.ContentType="multipart/alternative"
// MM.REL.ALT.HTML
New HTMLPart
Set HTMLPart=AltPart.AttachNewMessage()
Set HTMLPart.ContentType="text/html"
New tmpStream,Line
Set tmpStream=##class(%FileCharacterStream).%New()
Set tmpStream.Filename="\\notes01\datatr\Temp\infomails 06\embedded.htm"
For Quit:(tmpStream.AtEnd) Do
. Set Line=tmpStream.ReadLine()
. Do HTMLPart.TextData.WriteLine(Line)
// MM.REL.IMGs
New Imgs,ImgPart,ImgName,Status
Set Imgs=$LB("ORGALUXlogo.gif","LijnRoodboven.gif","01Beurs06.jpg","DS_iconen.jpg","06Beurs06.jpg","02Beurs06.jpg","07Beurs06.jpg","LijnRoodonder.gif")
For Loop=1:1:$LL(Imgs) Do
. Set ImgName=$LI(Imgs,Loop)
. Set ImgPart=RelPart.AttachNewMessage()
. Set ImgPart.IsBinary=1
. Set ImgPart.IsBase64=1
. Set ImgPart.ContentType="image/jpeg"
. Set Status=ImgPart.BinaryData.LinkToFile("\\notes01\datatr\Temp\infomails 06\"_ImgName)
. Quit:(Status'=1)
. Quit:(ImgPart.BinaryData.AtEnd)
. //Do ImgPart.Headers.SetAt("inline","Content-Disposition")
. Do ImgPart.Headers.SetAt(ImgName,"Content-ID")
. Do ImgPart.Headers.SetAt(ImgName,"name")
. Do ImgPart.Headers.SetAt(ImgName,"filename")
New SMTP
Set SMTP=##class(%Net.vhSMTP).%New()
Set SMTP.smtpserver="Notes01"
w "Send: "_$$ParseStatus^vhLib(SMTP.Send(MM))
Quit
Quit
Go2(to)
New MM
Set MM=##class(%Net.MailMessage).%New()
Set MM.From="Cache
"
Do MM.To.Insert("tr@vanhoecke.be")
Do:($D(to)) MM.To.Insert(to)
Set MM.Subject="Embedded mail via Cache"
Set MM.ContentType="multipart/alternative"
New TextPart
Set TextPart=MM.AttachNewMessage()
Set TextPart.ContentType="text/plain"
New HTMLPart
Set HTMLPart=MM.AttachNewMessage()
Set HTMLPart.ContentType="text/html"
New tmpStream,Line
Set tmpStream=##class(%FileCharacterStream).%New()
Set tmpStream.Filename="\\notes01\datatr\Temp\infomails 06\embedded.htm"
For Quit:(tmpStream.AtEnd) Do
. Set Line=tmpStream.ReadLine()
. Do HTMLPart.TextData.WriteLine(Line)
New Imgs,ImgPart,ImgName,Status
Set Imgs=$LB("ORGALUXlogo.gif","LijnRoodboven.gif","01Beurs06.jpg","DS_iconen.jpg","06Beurs06.jpg","02Beurs06.jpg","07Beurs06.jpg","LijnRoodonder.gif")
For Loop=1:1:$LL(Imgs) Do
. Set ImgName=$LI(Imgs,Loop)
. Set ImgPart=MM.AttachNewMessage()
. Set ImgPart.IsBinary=1
. Set ImgPart.IsBase64=1
. Set ImgPart.ContentType="image/jpeg"
. Set Status=ImgPart.BinaryData.LinkToFile("\\notes01\datatr\Temp\infomails 06\"_ImgName)
. Quit:(Status'=1)
. Quit:(ImgPart.BinaryData.AtEnd)
. Do ImgPart.Headers.SetAt("inline","Content-Disposition")
. Do ImgPart.Headers.SetAt(ImgName,"Content-ID")
. Do ImgPart.Headers.SetAt(ImgName,"name")
. Do ImgPart.Headers.SetAt(ImgName,"filename")
New SMTP
Set SMTP=##class(%Net.vhSMTP).%New()
Set SMTP.smtpserver="Notes01"
w "Send: "_$$ParseStatus^vhLib(SMTP.Send(MM))
Quit