got an Error If Send email with image using asp.net2.0

Discussion in 'Software' started by iquad, Aug 14, 2008.

  1. iquad

    iquad

    Joined:
    Nov 10, 2007
    Messages:
    2
    I got an error like "The SMTP server requires a secure connection or the client was not authenticated. The server response was: 5.5.1 Authentication Required. Learn more at " when i send a html formatted email. my code is


    -------------------------------------------------


    Try
    dim Mail as string=""
    Dim logo As New Net.Mail.LinkedResource(imageurl)

    logo.ContentId = "Logo"
    logo.TransferEncoding = System.Net.Mime.TransferEncoding.Base64

    Mail = Mail & "<b>Welcome to our site.com!!</b>"
    Mail = Mail & "<BR><img src=\"cid:Logo\" >""

    Dim alternateView1 As Net.Mail.AlternateView = Net.Mail.AlternateView.CreateAlternateViewFromString(Mail, System.Text.Encoding.UTF8, MediaTypeNames.Text.Html)
    alternateView1.LinkedResources.Add(logo)

    Dim Mailmessage As New System.Net.Mail.MailMessage
    Dim SmtpServer As New Net.Mail.SmtpClient()
    SmtpServer.Credentials = New System.Net.NetworkCredential("frommailid", "password")

    SmtpServer.Port = 587
    SmtpServer.Host = "smtp.gmail.com"

    Mailmessage.From = New System.Net.Mail.MailAddress("tomailid", "Indianitzone Team", System.Text.Encoding.UTF8)
    Mailmessage.Subject = subject

    Mailmessage.IsBodyHtml = True
    Mailmessage.BodyEncoding = System.Text.Encoding.UTF8
    Mailmessage.SubjectEncoding = System.Text.Encoding.UTF8

    Mailmessage.AlternateViews.Add(alternateView1)



    Mailmessage.DeliveryNotificationOptions = DeliveryNotificationOptions.OnFailure

    Mailmessage.To.Add("mail@gmail.com") 'to user


    SmtpServer.UseDefaultCredentials = False
    SmtpServer.DeliveryMethod = SmtpDeliveryMethod.Network
    SmtpServer.EnableSsl = True



    SmtpServer.Send(Mailmessage)

    Return True



    Catch ex As Exception

    Throw
    ' Return ex.Message.ToString & errormsg

    End Try
    ------------


    pls respond this problem.......
    thanks
     
    Last edited: Aug 14, 2008
    iquad, Aug 14, 2008
    #1
    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. Mahesh

    Any Net3.0 certification or start with 70-536(net2.0)

    Mahesh, Dec 27, 2007, in forum: Microsoft Certification
    Replies:
    0
    Views:
    552
    Mahesh
    Dec 27, 2007
  2. gautam2u@gmail.com
    Replies:
    2
    Views:
    1,678
    ProgTalk
    Feb 7, 2008
  3. statichash
    Replies:
    0
    Views:
    863
    statichash
    May 21, 2009
  4. statichash

    Make a testsite exact copy of an ASP.NET2.0 site

    statichash, May 21, 2009, in forum: General Computer Support
    Replies:
    2
    Views:
    1,302
    offshoredevelopment
    Jul 8, 2009
  5. IvanTsoi

    Problem in using linkbutton in asp.net2.0

    IvanTsoi, Jul 27, 2011, in forum: General Computer Support
    Replies:
    0
    Views:
    1,071
    IvanTsoi
    Jul 27, 2011
Loading...

Share This Page