开发者

Parse email address

I am writing VBA code i开发者_如何学Cn Outlook 2007 to extract email address from emails.

I am able to read the body as a whole through a variable

How do I extract email address from the variable?


One method is described here.

sString = "my1@email.com xxx my2@email.com yyy my3@email.com"
asString = Split(sString, " ")
For i = 0 To UBound(asString)
    If asString(i) Like "*@*.*" Then
        sEmail = sEmail & "," & asString(i)
    End If
Next

MsgBox Mid(sEmail, 2)


Why the body? Have you looked at the MailItem.Recipients collection (Recipient.Address) and the MailItem.SenderEmailAddress property?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜