Access 2010 VBA sends and email with a blank From property for specific users -
i'm having problem access 2010 vba, i'm sending email using access 2010 create outlook mail item, works great specific users mail send blank "from" account , outlook won't send intended recipients, cc person sending it. try set account sender using .sendusingaccount default account , won't work couple users. code below.
function f_email_via_outlook_html(varto, varcc, varbcc, varsubject, varbody, displaymsg boolean, optional attachmentpath) dim objoutlook outlook.application set objoutlook = new outlook.application dim objoutlookmsg outlook.mailitem 'dim objoutlookrecip outlook.recipient dim objoutlookattach outlook.attachment on error goto errorhandler 'create message. set objoutlookmsg = objoutlook.createitem(olmailitem) objoutlookmsg .subject = varsubject .bodyformat = olformathtml .htmlbody = varbody .to = varto .cc = varcc .bcc = varbcc .sendusingaccount = objoutlook.session.accounts.item(1) ' add attachments message. if ismissing(attachmentpath) = false set objoutlookattach = .attachments.add(attachmentpath) end if ' resolve each recipient's name. 'for each objoutlookrecip in .recipients ' objoutlookrecip.resolve 'next ' should display message before sending? if displaymsg .display else .save .send end if end set objoutlook = nothing exit function errorhandler: errnamefrom = "email_via_outlook" msgbox "error occured @ " & errnamefrom & ":" & err.number & ";" & err.description end function
Comments
Post a Comment