Results 1 to 2 of 2

Thread: Exchange Server email gets stuck in drafts folder not being sent

  1. #1
    Daru is offline VB.NET Forum Newbie
    .NET Framework
    .NET 4.0
    Join Date
    May 2012
    Posts
    2
    Reputation
    0

    Exchange Server email gets stuck in drafts folder not being sent

    I'm trying to use an Exchange Server to send emails from asp.net web application and atm the mail is getting stuck in the drafts folder and not being sent.
    Emails are being sent fine if i send them using browser or outlook directly. Also if i go to the drafts folder and manually send the vb.net created emails they re being sent and received fine aswell, but that isn't a long term option. If anyone has any idea what is the problem i'ld appreciate the input.
    Here is the relevant part of the code i m using.

    Try
    Dim service As ExchangeService
    Dim service As New ExchangeService(ExchangeVersion.Exchange2007_SP1)
    service.Credentials = New WebCredentials(System.Configuration.ConfigurationManager.AppSettings("Username"), _
    System.Configuration.ConfigurationManager.AppSettings("Password"))
    service.Url = New Uri(System.Configuration.ConfigurationManager.AppSettings("ExchangeServer"))

    Dim message As New EmailMessage(service)

    message.Subject = New String("Test")
    message.Body = New String("Just testing")
    message.ToRecipients.Add(name, email)
    message.SendAndSaveCopy()

    Catch ex As Exception
    Return False
    End Try
    Return True
    Last edited by Paszt; 05-11-2012 at 4:35 PM. Reason: added [xcode] blocks for readability

  2. #2
    jamie_pattison is offline VB.NET Forum Fanatic
    .NET Framework
    .NET 3.0 (VS 2005/2008)
    Join Date
    Sep 2008
    Posts
    116
    Reputation
    62
    Is there any reason why you dont you use System.Net.Mail?

    System.Net.Mail Namespace ()

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Harvest time tracking