jamajam
02-16-2011, 04:01 AM
This is probably quite a simple problem but I've spent days trawling the internet to try and find an answer so I'd be very grateful if someone could put me out of my misery and solve this for me.
At work, we have a main email address used by 3 different people on three different computers. I've set up some rules on each machine but they're dependent on a BCC copy email being emailed back to our main email address but with the initial's of the person who sent it, added to the subject line.
I've used this BCC code below with 'sent by XX' added. This works fine and is just what we need but the problem is, if we reply to an email or forward one, originally sent by us, the 'sent by' bit keeps getting repeated e.g. 'test message subject - sent by XX - sent by XX - sent by XX '
So I just want to get rid of the unwanted extra 'sent by's. I tried by using a delimiter but as I don't really understand what I'm doing, I was unable to get the original subject saved, only the 'sent by' part.
Here is the code with the 'sent by' part added in red:
Private Sub Application_ItemSend(ByVal Item As Object, _
Cancel As Boolean)
Dim objRecip As Recipient
Dim strMsg As String
Dim res As Integer
Dim strBcc As String
On Error Resume Next
' #### USER OPTIONS ####
' address for Bcc -- must be SMTP address or resolvable
' to a name in the address book
strBcc = "someone@somewhere.dom"
Item.Subject = Item.Subject & " - sent by JM"
Set objRecip = Item.Recipients.Add(strBcc)
objRecip.Type = olBCC
If Not objRecip.Resolve Then
strMsg = "Could not resolve the Bcc recipient. " & _
"Do you want still to send the message?"
res = MsgBox(strMsg, vbYesNo + vbDefaultButton1, _
"Could Not Resolve Bcc Recipient")
If res = vbNo Then
Cancel = True
End If
End If
Set objRecip = Nothing
End Sub
If anyone could help, I'd be much obliged. Thanks
At work, we have a main email address used by 3 different people on three different computers. I've set up some rules on each machine but they're dependent on a BCC copy email being emailed back to our main email address but with the initial's of the person who sent it, added to the subject line.
I've used this BCC code below with 'sent by XX' added. This works fine and is just what we need but the problem is, if we reply to an email or forward one, originally sent by us, the 'sent by' bit keeps getting repeated e.g. 'test message subject - sent by XX - sent by XX - sent by XX '
So I just want to get rid of the unwanted extra 'sent by's. I tried by using a delimiter but as I don't really understand what I'm doing, I was unable to get the original subject saved, only the 'sent by' part.
Here is the code with the 'sent by' part added in red:
Private Sub Application_ItemSend(ByVal Item As Object, _
Cancel As Boolean)
Dim objRecip As Recipient
Dim strMsg As String
Dim res As Integer
Dim strBcc As String
On Error Resume Next
' #### USER OPTIONS ####
' address for Bcc -- must be SMTP address or resolvable
' to a name in the address book
strBcc = "someone@somewhere.dom"
Item.Subject = Item.Subject & " - sent by JM"
Set objRecip = Item.Recipients.Add(strBcc)
objRecip.Type = olBCC
If Not objRecip.Resolve Then
strMsg = "Could not resolve the Bcc recipient. " & _
"Do you want still to send the message?"
res = MsgBox(strMsg, vbYesNo + vbDefaultButton1, _
"Could Not Resolve Bcc Recipient")
If res = vbNo Then
Cancel = True
End If
End If
Set objRecip = Nothing
End Sub
If anyone could help, I'd be much obliged. Thanks