vba - Send Email from different email accounts -


when send emails go out personal inbox @ work, need them go out mailbox have access to. have both mailboxes in outlook.

can send emails specific mailbox?

here code using. not find 2nd item in account.

 sub mail_small_text_change_account()      dim cel range     dim outapp outlook.application     dim outmail outlook.mailitem     dim strbody string      set outapp = createobject("outlook.application")     set outmail = outapp.createitem(olmailitem)      strbody = "hi there" & vbnewline & vbnewline & _           "this line 1" & vbnewline & _           "this line 2" & vbnewline & _           "this line 3" & vbnewline & _           "this line 4"      on error resume next      each cel in range(("c2"), range("c2").end(xldown))         outmail             .to = cel.value             '.cc = cel.offset(0, 3).value             .subject = "benefits refund"             .body = strbody             .sendusingaccount = outapp.session.accounts.item(2)             .send   'or use .display         end      next      on error goto 0      set outmail = nothing     set outapp = nothing end sub 

yes. using pop mail box, can specify user name , password account.

.to = "e@e.com" .cc = "" .bcc = "" .subject = "this subject line" .body = "this body" .sendusingaccount = outapp.session.accounts.item(1) 

Comments

Popular posts from this blog

php - regexp cyrillic filename not matches -

c# - OpenXML hanging while writing elements -

sql - Select Query has unexpected multiple records (MS Access) -