sending email problem

Discussion in 'ASP .Net' started by Lenny, Feb 27, 2007.

  1. Lenny

    Lenny Guest

    I wrote this function to send an email
    the problem is that I do not receive any error from .net but the email is
    not delivered.
    smtp server is not local but from my ISP

    any suggestion on how to understand the problem?

    thanks
    Lenny

    <system.net>
    <mailSettings>
    <smtp from="xxxxxxxxxxxxxx">
    <network host="smtp.xxxxxxxxxxx.it" port="25" userName="xxxxxxxxx"
    password="xxxxxxx"/>
    </smtp>
    </mailSettings>
    </system.net>


    Public Shared Sub inviamail(ByVal from As String, ByVal recepient As
    String, ByVal bcc As String, ByVal cc As String, ByVal subject As String,
    ByVal body As String)
    ' Instantiate a new instance of MailMessage
    Dim mMailMessage As New MailMessage()
    ' Set the sender address of the mail message
    mMailMessage.From = New MailAddress(from)
    ' Set the recepient address of the mail message
    mMailMessage.To.Add(New MailAddress(recepient))

    ' Check if the bcc value is nothing or an empty string
    If Not bcc Is Nothing And bcc <> String.Empty Then
    ' Set the Bcc address of the mail message
    mMailMessage.Bcc.Add(New MailAddress(bcc))
    End If

    ' Check if the cc value is nothing or an empty value
    If Not cc Is Nothing And cc <> String.Empty Then
    ' Set the CC address of the mail message
    mMailMessage.CC.Add(New MailAddress(cc))
    End If

    ' Set the subject of the mail message
    mMailMessage.Subject = subject
    ' Set the body of the mail message
    mMailMessage.Body = body

    ' Set the format of the mail message body as HTML
    mMailMessage.IsBodyHtml = True
    ' Set the priority of the mail message to normal
    mMailMessage.Priority = MailPriority.Normal

    ' Instantiate a new instance of SmtpClient
    Dim mSmtpClient As New SmtpClient()
    ' Send the mail message
    mSmtpClient.Send(mMailMessage)
    End Sub
     
    Lenny, Feb 27, 2007
    #1
    1. Advertising

  2. Lenny

    Lenny Guest

    I found the problem

    the problem is not the code,
    it's the antispam in the destination mail that deleted my test messages.

    bye

    Lenny


    "Lenny" <> wrote in message
    news:...
    >I wrote this function to send an email
    > the problem is that I do not receive any error from .net but the email is
    > not delivered.
    > smtp server is not local but from my ISP
    >
    > any suggestion on how to understand the problem?
    >
    > thanks
    > Lenny
    >
    > <system.net>
    > <mailSettings>
    > <smtp from="xxxxxxxxxxxxxx">
    > <network host="smtp.xxxxxxxxxxx.it" port="25" userName="xxxxxxxxx"
    > password="xxxxxxx"/>
    > </smtp>
    > </mailSettings>
    > </system.net>
    >
    >
    > Public Shared Sub inviamail(ByVal from As String, ByVal recepient As
    > String, ByVal bcc As String, ByVal cc As String, ByVal subject As String,
    > ByVal body As String)
    > ' Instantiate a new instance of MailMessage
    > Dim mMailMessage As New MailMessage()
    > ' Set the sender address of the mail message
    > mMailMessage.From = New MailAddress(from)
    > ' Set the recepient address of the mail message
    > mMailMessage.To.Add(New MailAddress(recepient))
    >
    > ' Check if the bcc value is nothing or an empty string
    > If Not bcc Is Nothing And bcc <> String.Empty Then
    > ' Set the Bcc address of the mail message
    > mMailMessage.Bcc.Add(New MailAddress(bcc))
    > End If
    >
    > ' Check if the cc value is nothing or an empty value
    > If Not cc Is Nothing And cc <> String.Empty Then
    > ' Set the CC address of the mail message
    > mMailMessage.CC.Add(New MailAddress(cc))
    > End If
    >
    > ' Set the subject of the mail message
    > mMailMessage.Subject = subject
    > ' Set the body of the mail message
    > mMailMessage.Body = body
    >
    > ' Set the format of the mail message body as HTML
    > mMailMessage.IsBodyHtml = True
    > ' Set the priority of the mail message to normal
    > mMailMessage.Priority = MailPriority.Normal
    >
    > ' Instantiate a new instance of SmtpClient
    > Dim mSmtpClient As New SmtpClient()
    > ' Send the mail message
    > mSmtpClient.Send(mMailMessage)
    > End Sub
    >
    >
     
    Lenny, Feb 27, 2007
    #2
    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. bivin
    Replies:
    1
    Views:
    735
    venkat
    Jun 27, 2003
  2. =?Utf-8?B?UGF1cmF2aQ==?=

    Problem with Sending Email outside of Domain

    =?Utf-8?B?UGF1cmF2aQ==?=, Feb 12, 2004, in forum: ASP .Net
    Replies:
    5
    Views:
    3,420
    Chad Z. Hower aka Kudzu
    Feb 18, 2004
  3. Rob G
    Replies:
    17
    Views:
    2,093
  4. Luke
    Replies:
    2
    Views:
    4,812
    Nigel Wade
    Mar 15, 2007
  5. rote
    Replies:
    8
    Views:
    796
Loading...

Share This Page