[英]Forward email by subject edit body
I want to forward every mail with a specific subject to an e-mail. 我想将具有特定主题的每封邮件转发到一封电子邮件。 To the content of the original mail, a specific content ("geprüft") should be added.
在原始邮件的内容中,应添加特定的内容(“geprüft”)。 I have the code now, but it doesn't work properly.
我现在有代码,但是无法正常工作。 It sends the last E-Mail clicked on :(.
它发送最后单击:(的电子邮件。
Sub Test(oMail As MailItem) Dim MyItem As Outlook.MailItem Dim obj_curitem As MailItem Dim obj_newitem Dim obj_Selection Dim obj_curfolder Dim obj_msgitems Dim Forward As Object
If Err.Number = 0 Then
Set obj_Selection = Outlook.ActiveExplorer.Selection
If obj_Selection.Count > 0 Then
For Each obj_curitem In obj_Selection
strID = obj_curitem.EntryID
Set olNS = Application.GetNamespace("MAPI")
'Object auf einem neuen Item erstellen
Set obj_newitem = obj_curitem.Forward
With obj_curitem.Forward
.Forward = True
.SentOnBehalfOfName = "###" 'Deine Mailadresse
.Subject = "WG" & .Subject 'Betreff
.To = "###" 'Empfängermail
.BODY = "geprüft" & .BODY 'E-Mail Inhalt
.Send
End With
Next
End If End If End Sub
This loop works fine for me: 这个循环对我来说很好:
Dim tmpMail As MailItem
For Each tmpMail In ActiveExplorer.Selection
Debug.Print tmpMail.Subject
With tmpMail.Forward
.Forward = True
.SentOnBehalfOfName = "###"
'.Subject = "WG" & .Subject 'WG is automatically added when forwarding
.To = "###"
.Body = "geprüft" & Chr(10) & .Body
.Send
End With
Next tmpMail
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.