Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1117
  • Last Modified:

MS Outlook+Word 2010: Mail Merge from IMAP Organizational Account

I have a mail merge template as well as excel file which we're merging the data from; these function, we've tested several times with no issues.

Our problem, however, lies in the fact that the Mail Merge mechanism sends from our personal account. We work from a large Enterprise-level organization and we need to be able to send from a organizational account ( collective_us@thisplace.com as opposed to john.doe@thisplace.com ).

I've built different profiles, I've attempted to route and forward through other accounts, I've even played with delegation. In all, the efforts have failed. Has anyone else encountered this issue, and if so, what was your solution?
0
jalongoria
Asked:
jalongoria
  • 2
1 Solution
 
Rgonzo1971Commented:
Hi,

you could use the property sendusingaccount to adapt this code

Sub SendDocumentInMail()

Dim bStarted As Boolean
Dim oOutlookApp As Outlook.Application
Dim oItem As Outlook.MailItem

On Error Resume Next

'Get Outlook if it's running
Set oOutlookApp = GetObject(, "Outlook.Application")
If Err <> 0 Then
    'Outlook wasn't running, start it from code
    Set oOutlookApp = CreateObject("Outlook.Application")
    bStarted = True
End If

'Create a new mailitem
Set oItem = oOutlookApp.CreateItem(olMailItem)

With oItem
    'Set the recipient for the new email
   .To = "recipient@mail.com"
    'Set the recipient for a copy
    .CC = "recipient2@mail.com"
    'Set the subject
    .Subject = "New subject"
    'The content of the document is used as the body for the email
    .Body = ActiveDocument.Content
    .Send
End With

If bStarted Then
    'If we started Outlook from code, then close it
    oOutlookApp.Quit
End If

'Clean up
Set oItem = Nothing
Set oOutlookApp = Nothing

End Sub

Open in new window


reference
http://msdn.microsoft.com/en-us/library/office/ff869311.aspx

Regards
0
 
jalongoriaAuthor Commented:
Thanks for the insight! I had been looking through MSDN and came across that very function, but I couldn't figure out how to implement it because it seemed to be committed to POP3 versus IMAP. I'll try this method and see what happens!
0
 
Rgonzo1971Commented:
Hi,

Maybe this could help to choose the account
http://social.technet.microsoft.com/Forums/en-US/outlook/thread/f6710ef7-571d-41ed-8090-a244b96e8f2c
Private Sub Application_ItemSend(ByVal Item As Object, Cancel As Boolean)
'MVP OShon from VBATools.pl
If Item.Class = 43 Then
Dim objMailItem As MailItem
Set objMailItem = Item

Dim olNS As Outlook.NameSpace
Set olNS = Application.GetNamespace("MAPI")

Dim wybor$, lista$, x&
For x = 1 To olNS.Accounts.Count
 lista = lista & x & " -" & olNS.Accounts.Item(x).DisplayName & vbCr
Next x

wybor = InputBox("Select the account number from the list below:" & vbCr & lista, _
 "Broadcasting from a specific account VBATools.pl", 1)

If Len(wybor) = 0 Then Cancel = True

With objMailItem
 If IsNumeric(wybor) = True Then
 if wybor > x then goto blad
 .SendUsingAccount = olNS.Accounts.Item(wybor)
 .Save
 Else
blad:
 Cancel = True
 MsgBox "Not chosen properly account number", vbExclamation, _
 "Broadcasting from a specific account VBATools.pl"
 End If
End With

Set objMailItem = Nothing
Set olNS = Nothing
End If
End Sub

Open in new window


Regards
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now