任何人在這裏有使用Exchange Web服務的經驗。郵寄通過交換web服務(VB.NET)
我正在嘗試使用webservice向自己發送電子郵件。此電子郵件有另一個地址作爲發件人,但它一直以我的收件人的電子郵件地址作爲發件人,而不是:■
這是我的代碼:
Dim Message As MessageType = New MessageType()
Message.Subject = txt
Message.Body = New BodyType()
Message.Body.Value = ActiesOverzicht
Message.Sender = New SingleRecipientType
Message.Sender.Item = New EmailAddressType
Message.Sender.Item.EmailAddress = SenderEmail
Message.ToRecipients = New EmailAddressType(0) {}
Message.ToRecipients(0) = New EmailAddressType()
Message.ToRecipients(0).EmailAddress = RecipientsEmail
Message.Sensitivity = SensitivityChoicesType.Normal
此消息進入一個列表中,併發送與下面的代碼:
Public Sub SendMailToOperator(messageList As List(Of MessageType), esb As ExchangeServiceBinding)
' Create the CreateItem request.
Dim createEmailRequest As New CreateItemType()
' Specifiy how the e-mail will be handled.
createEmailRequest.MessageDisposition = MessageDispositionType.SendOnly
createEmailRequest.MessageDispositionSpecified = True
' Create the array of items.
createEmailRequest.Items = New NonEmptyArrayOfAllItemsType()
' Add the message to the array of items to be created.
createEmailRequest.Items.Items = messageList.ToArray()
'createEmailRequest.Items.Items(0) = Message
' Send a CreateItem request and get the CreateItem
' response.
Dim createItemResponse As CreateItemResponseType = esb.CreateItem(createEmailRequest)
End Sub
有沒有人有任何想法如何解決這個問題?或者是什麼導致它?
在這種情況下,你的收件人是你自己?交流可能會挑起這一點。 –