send email with .net code

Discussion in 'ASP .Net' started by =?Utf-8?B?ZnJhbms=?=, Aug 31, 2006.

  1. I need help please!

    I write a method to send email and there is a button on a web page, click
    the button will call the method. everything seems ok. but the email never be
    sent.
    --------------------
    button click: SendMail("")

    Public Function SendMail(ByVal toAddr As String) As Boolean
    Dim myMessage As New MailMessage

    myMessage.To = toAddr
    myMessage.From = ""
    myMessage.Subject = "Vaughan GIS System"
    myMessage.BodyFormat = MailFormat.Text

    myMessage.Body = "www.vaughangis.info"

    Mail.SmtpMail.SmtpServer = "10.141.140.69"

    Try
    SmtpMail.Send(myMessage)
    Catch ex As Exception
    ErrMsg = ex.Message
    Return False
    End Try
    Return True
    End Function
    ---------------
    =?Utf-8?B?ZnJhbms=?=, Aug 31, 2006
    #1
    1. Advertising

  2. 1. Make sure you have an SMTP server set up (can be Exchange)
    2. Make sure you are configured to use this server
    3. Make sure you have rights to relay messages if you are using a server

    Any of these can bomb things. If you are using the MS SMTP Server that ships
    with the OS, check the mail folder and see if you have stuck messages. If
    so, you are contacting the SMTP service, but it is not relaying the messages
    (does not know how to send things out). If not, you are not properly
    configured to use the SMTP service.

    If you are using Exchange or another server option, check with your admin
    and see if you are even getting into the system.

    --
    Gregory A. Beamer
    MVP; MCP: +I, SE, SD, DBA

    *************************************************
    Think outside of the box!
    *************************************************
    "frank" <> wrote in message
    news:...
    >I need help please!
    >
    > I write a method to send email and there is a button on a web page, click
    > the button will call the method. everything seems ok. but the email never
    > be
    > sent.
    > --------------------
    > button click: SendMail("")
    >
    > Public Function SendMail(ByVal toAddr As String) As Boolean
    > Dim myMessage As New MailMessage
    >
    > myMessage.To = toAddr
    > myMessage.From = ""
    > myMessage.Subject = "Vaughan GIS System"
    > myMessage.BodyFormat = MailFormat.Text
    >
    > myMessage.Body = "www.vaughangis.info"
    >
    > Mail.SmtpMail.SmtpServer = "10.141.140.69"
    >
    > Try
    > SmtpMail.Send(myMessage)
    > Catch ex As Exception
    > ErrMsg = ex.Message
    > Return False
    > End Try
    > Return True
    > End Function
    > ---------------
    Cowboy \(Gregory A. Beamer\), Aug 31, 2006
    #2
    1. Advertising

  3. =?Utf-8?B?ZnJhbms=?=

    Mark Rae Guest

    Mark Rae, Aug 31, 2006
    #3
  4. =?Utf-8?B?ZnJhbms=?=

    sloan Guest

    http://sholliday.spaces.live.com/
    2/8/2006 entry

    I have 1.1 and 2.0 samples. There is also "authentication" modes you have
    to consider.


    "frank" <> wrote in message
    news:...
    > I need help please!
    >
    > I write a method to send email and there is a button on a web page, click
    > the button will call the method. everything seems ok. but the email never

    be
    > sent.
    > --------------------
    > button click: SendMail("")
    >
    > Public Function SendMail(ByVal toAddr As String) As Boolean
    > Dim myMessage As New MailMessage
    >
    > myMessage.To = toAddr
    > myMessage.From = ""
    > myMessage.Subject = "Vaughan GIS System"
    > myMessage.BodyFormat = MailFormat.Text
    >
    > myMessage.Body = "www.vaughangis.info"
    >
    > Mail.SmtpMail.SmtpServer = "10.141.140.69"
    >
    > Try
    > SmtpMail.Send(myMessage)
    > Catch ex As Exception
    > ErrMsg = ex.Message
    > Return False
    > End Try
    > Return True
    > End Function
    > ---------------
    sloan, Sep 1, 2006
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Peter
    Replies:
    0
    Views:
    3,336
    Peter
    Jul 1, 2003
  2. Replies:
    2
    Views:
    385
    Tintin
    Jan 5, 2007
  3. Replies:
    13
    Views:
    448
    Randy Webb
    May 14, 2006
  4. pbd22
    Replies:
    1
    Views:
    138
  5. ashish makani
    Replies:
    5
    Views:
    564
    Mark Lawrence
    Sep 20, 2012
Loading...

Share This Page