embed image into mail body using access vba -
i using code below send out mails access attachment. searched everywhere no luck sokution attachment embeded mail body itself. can me out.
option compare database option explicit 'declare public object variables public mkfdoc string public subject, attachment, recipient, copyto, bodytext, username, saveit public maildb object 'the mail database public maildbname string 'the current users notes mail database name public maildoc object 'the mail document public attachme object 'the attachment richtextfile object public session object 'the notes session public embedobj object 'the embedded object (attachment) public function sendnotes(byval strto string, byval attachment string, byval strsubject string, byval strbody string) 'set objects required automation lotus notes subject = strsubject 'attachment = "c:\foldername\filename.extension" recipient = split(strto, ",") 'set bodytext mail offer - language depends on field in offprofrm bodytext = strbody 'start session notes set session = createobject("notes.notessession") 'open mail database in notes set maildb = session.getdatabase("", maildbname) if maildb.isopen = true 'already open mail else maildb.openmail end if 'set new mail document set maildoc = maildb.createdocument maildoc.form = "memo" maildoc.sendto = recipient maildoc.subject = subject maildoc.body = bodytext maildoc.savemessageonsend = true 'set embedded object , attachment , attach if attachment <> "" set attachme = maildoc.createrichtextitem("attachment") set embedobj = attachme.embedobject(1454, "", attachment, "attachment") maildoc.createrichtextitem ("attachment") end if 'send document + notify maildoc.posteddate = now() 'gets mail appear in sent items folder maildoc.send 0, recipient 'clean set maildb = nothing set maildoc = nothing set attachme = nothing set session = nothing set embedobj = nothing end function
a way create email included attachments in body field use mime format.
set body = maildoc.createmimeentity("body") ...
have @ http://www-10.lotus.com/ldd/bpmpblog.nsf/dx/creating-a-mime-email-with-attachment , https://stackoverflow.com/a/2514633/2065611 how it.
Comments
Post a Comment