Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. email sending using exchange server 2003 and VS 2005

email sending using exchange server 2003 and VS 2005

Scheduled Pinned Locked Moved Visual Basic
visual-studiosysadminhelp
3 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    steve_rm
    wrote on last edited by
    #1

    Hello, Does any one have any information for sending e-mail using exchange server 2003. I am using vs 2005 and need to be able to send e-mail from a windows application and have the exchange server send it to the destination e-mail. If anyone can point me in the right direction or have some information that will be a great help. I have been told that this is very difficult to do. Many thank for any help you can give me, Steve

    J 1 Reply Last reply
    0
    • S steve_rm

      Hello, Does any one have any information for sending e-mail using exchange server 2003. I am using vs 2005 and need to be able to send e-mail from a windows application and have the exchange server send it to the destination e-mail. If anyone can point me in the right direction or have some information that will be a great help. I have been told that this is very difficult to do. Many thank for any help you can give me, Steve

      J Offline
      J Offline
      JustmeNick
      wrote on last edited by
      #2

      first you need to import this mail class Imports System.Web.Mail Dim mail As New MailMessage mail.To = anyone@someDomain mail.From = user@yourDomain mail.Subject = "message subject comes here" mail.Body = "body of the message.. could be from a textbox" SmtpMail.SmtpServer = "MailServerName" 'your real server name goes here SmtpMail.Send(mail) ' this section is what sends the mail... this is perfectly fine....i have use it.. the from email account..must exist on the exchange mail server account.. so if you have an account on that server.. use it for the from section or just create a temp account to be used for this purpose.. hope this helps..

      Nab

      S 1 Reply Last reply
      0
      • J JustmeNick

        first you need to import this mail class Imports System.Web.Mail Dim mail As New MailMessage mail.To = anyone@someDomain mail.From = user@yourDomain mail.Subject = "message subject comes here" mail.Body = "body of the message.. could be from a textbox" SmtpMail.SmtpServer = "MailServerName" 'your real server name goes here SmtpMail.Send(mail) ' this section is what sends the mail... this is perfectly fine....i have use it.. the from email account..must exist on the exchange mail server account.. so if you have an account on that server.. use it for the from section or just create a temp account to be used for this purpose.. hope this helps..

        Nab

        S Offline
        S Offline
        steve_rm
        wrote on last edited by
        #3

        Hello, Thanks for your help. The code i used is below. But I got a warning saying that using system.web.mail is obsolete and system.net.mail is the recommended to be used instead. Also using the MS Exchange is very slow, i tried to send an e-mail to my hotmail and gmail account it takes more than 10 minutes to get there. Is there any setting on the microsoft exchange server that need to be set? Another quick question, is there a way to get the server name and the e-mail account automatically instead of a user inputting in? They can just click the send button. Many thanks for your time, Steve Code for using system.web.mail Private Sub btnSendExchangeServer_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSendExchangeServer.Click Dim mailMsg As New MailMessage() mailMsg.To = "steve@clarityform.com" mailMsg.From = "steve@clarityform.com" mailMsg.Subject = "2nd Microsoft Exchange Server Mail Test" mailMsg.Body = "This email came from MS Exchange Server" Try SmtpMail.SmtpServer = "cf01.clarityforms.com" SmtpMail.Send(mailMsg) Catch ex As Net.Mail.SmtpException MessageBox.Show(ex.Message) Catch ex As Exception MessageBox.Show(ex.Message) End Try End Sub End Class Code for using gmail smpt server using system.net.mail Private Sub btnSendMail_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSendMail.Click Dim msgTo As New MailAddress("steve@clarityforms.com") Dim msgFrom As New MailAddress("steve@clarityforms.com") Dim msgSender As New MailAddress("steve@clarityforms.com") Dim mailMsg As New MailMessage() mailMsg.Sender = msgSender mailMsg.To.Add(msgTo) mailMsg.Priority = MailPriority.High mailMsg.CC.Add("Steve1_rm@yahoo.com") mailMsg.Subject = "This is a mail test" mailMsg.Body = "This is the body of the e-mail, Enjoy" mailMsg.From = msgFrom Dim client As New SmtpClient("smtp.gmail.com", 587) client.Credentials = New System.Net.NetworkCredential("steve1.rm@gmail.com", "1apple2") client.EnableSsl = True Try client.Send(mailMsg) Catch ex As SmtpException MessageBox.Show(ex.Message) Catch ex As Exception MessageBox.Show(ex.Message) End Try End Sub

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups