I found the following code here: http://stackoverflow.com/questions/2...email-dependin
It worked then it just stopped working. Any suggestions?
Again, Thanks in advance.
a
Private Sub Application_ItemSend(ByVal Item As Object, Cancel As Boolean)
Dim objRecip As Recipient
Dim strMsg As String
Dim strSendUsingAccount As String
Dim res As Integer
Dim strBcc As String
On Error Resume Next
'Figure out which email account you are using to send email
strSendUsingAccount = Item.SendUsingAccount
'Throw an error if you are using your internal email account
If strSendUsingAccount = "SomeAddress@Somedomain.***" Then
strMsg = "You are trying to send an email using your internal Scanner Email account, which you can't do..." & vbCr & vbCr & "Please select a DIFFERENT email account to send the email from."
res = MsgBox(strMsg, vbOKOnly + vbExclamation, "Sending Mail Error")
Cancel = True
Exit Sub
End If
'If sending from account
If strSendUsingAccount = "My Name (WORK)" Then
strBcc = "MyName@workdommain.com"
End If
'If sending from account
If strSendUsingAccount = "My Name" Then
strBcc = "MyName@gmail.com"
End If
'Choose whether CC/BCC recipient
Set objRecip = Item.Recipients.Add(strBcc)
objRecip.Type = olBCC
'Resolve it?
objRecip.Resolve
'Clear the recipient
Set objRecip = Nothing
End Sub