M
mrsadmin
Hi there,
I'm expanding on one of my projects and I'm having issues with 1 section of the code.
Scenario:
Original received mail, I forward as a new obj to my help desk, and the file updates correctly in the helpdesk system.
The problems are this: The mail I'm using has already been forwarded on to me by my distributor (they refuse to send to our support account) and so I lose the very original subject line and the original sender. Luckily the subject line has been saved as part of the text in the email as has the sender. The unlucky part is that it's between "" so my search function has issues.
Please advise.
Existing code:
Sup#1: I actually want objMail.Subject = objitem.Subject to be objMail.Subject = objitem.Body search string "original subject line in body of email"
Sup#2: I need to get the email address from the text here: Email: address
I currently have 2 instances of the code, 1 for each of the Distributors as they have different details, as you can see above. The code works well, it's just trying to extract this information.
Thank you
I'm expanding on one of my projects and I'm having issues with 1 section of the code.
Scenario:
Original received mail, I forward as a new obj to my help desk, and the file updates correctly in the helpdesk system.
The problems are this: The mail I'm using has already been forwarded on to me by my distributor (they refuse to send to our support account) and so I lose the very original subject line and the original sender. Luckily the subject line has been saved as part of the text in the email as has the sender. The unlucky part is that it's between "" so my search function has issues.
Please advise.
Existing code:
Code:
Sub Fwdfsp()
'source: http://bit.ly/N7ENSk (spiceworks) forward email to helpdesk as new ticket
'source: http://bit.ly/1bJRdeQ (microsoft) (on behalf of)
Dim stsaddress As String
Dim objMail As Outlook.MailItem
Dim strbody As String
Dim oldmsg As String
Dim senderaddress As String
Dim addresstype As Integer
' Set this variable as your helpdesk e-mail address
stsaddress = "my@email"
Set objitem = GetCurrentItem()
Set objMail = objitem.Forward
'Sender email address this is fine for Sup#1, but not for Sup#2
For Each Recipient In objitem.Recipients
senderaddress = Recipient.Address
'Get my address for reference in the new email body
myaddress = objitem.CC
'Searches for @ in the email address to determine if it is an exchange user
addresstype = InStr(senderaddress, "@")
' If the address is an Exchange DN use the Senders Name
If addresstype = 0 Then
senderaddress = objitem.Recipients
End If
'adds the senders e-mail address as the created by object for the ticket and appends the message body
strbody = objitem.HTMLBody
objMail.To = stsaddress
objMail.Subject = objitem.Subject
objMail.HTMLBody = strbody & "<br /><br /><font color='#000080' face='Calibri' size='1'>Received by: " & myaddress & vbNewLine & vbNewLine
objMail.SentOnBehalfOfName = senderaddress
'remove the comment from below to display the message before sending
objMail.Display
'Automatically Send the ticket
'objMail.Send
Next
Set objitem = Nothing
Set objMail = Nothing
End Sub
Sup#1: I actually want objMail.Subject = objitem.Subject to be objMail.Subject = objitem.Body search string "original subject line in body of email"

Sup#2: I need to get the email address from the text here: Email: address

I currently have 2 instances of the code, 1 for each of the Distributors as they have different details, as you can see above. The code works well, it's just trying to extract this information.
Thank you
