Authentication problem when sending email

FDisk

Newcomer
Joined
Apr 17, 2004
Messages
9
I'm trying to submit a form by email using VB.NET

I was using my personal email address for testing purposes, but now that I'm trying to use my hosting company's (Interland) I get the following error:

550 5.1.1 You must be authenticated to use this server

Here's the code as it stands now:

Code:
Private Sub SendEmail()
        Dim email As New System.Web.Mail.MailMessage 'Declares new email msg

        email.To = Session("strEmail") 'Receiver
        email.From = "confirmation@xx.xxx.xx.xx" 'Sender
        email.Subject = "We received your information!" 'Subject

        email.Body = "Dear " & Salutation() & Session("strLastName") & vbCrLf & vbCrLf & _
        "This is an email confirming that we have received the" _
        & " information from your questionnaire and are in the process of reviewing it.  One of" _
        & " our certified physicians will get back to you as soon as possible."  'Body


        System.Web.Mail.SmtpMail.SmtpServer = "smtp.registeredsite.com" 'SMTP server
        System.Web.Mail.SmtpMail.Send(email) 'Sends the email
    End Sub

I also have the possibility of using an HTTP email address a la Hotmail; does .NET support this? If so, would I need to put somewhere in the code the username and password for the email account?

Thanks in advance for the help
 
I used to be with Interland but I can't find my old code, anyway, they have samples in their knowledge base section, I think you would put smtp.yourDomain.com instead of smtp.registeredsite.com
 
Sending mail with Auth

Look in the knowledge base.

System.Web.Mail.Message.Fields <=== if you add something here... you'll be able to specify the following :
  • Username
  • Password
  • Port
  • Server
  • Kind of Smtp Server (IMAP ? SMTP ?)
Here is a sample code from one of my program :
Code:
MailMessage msg = new MailMessage();
msg.Fields["http://schemas.microsoft.com/cdo/configuration/smtpserver"] = m_Server;
msg.Fields["http://schemas.microsoft.com/cdo/configuration/smtpserverport"] = m_Port;
msg.Fields["http://schemas.microsoft.com/cdo/configuration/sendusername"] = username;
msg.Fields["http://schemas.microsoft.com/cdo/configuration/sendpassword"] = password;
When your message is done... just send it like any other mail and it will be perfect.

Look in my signature for translation of C# to VB
 
Arch4ngel said:
Look in the knowledge base.

System.Web.Mail.Message.Fields <=== if you add something here... you'll be able to specify the following :
  • Username
  • Password
  • Port
  • Server
  • Kind of Smtp Server (IMAP ? SMTP ?)
Here is a sample code from one of my program :
Code:
MailMessage msg = new MailMessage();
msg.Fields["http://schemas.microsoft.com/cdo/configuration/smtpserver"] = m_Server;
msg.Fields["http://schemas.microsoft.com/cdo/configuration/smtpserverport"] = m_Port;
msg.Fields["http://schemas.microsoft.com/cdo/configuration/sendusername"] = username;
msg.Fields["http://schemas.microsoft.com/cdo/configuration/sendpassword"] = password;
When your message is done... just send it like any other mail and it will be perfect.

Look in my signature for translation of C# to VB

You rule, thank you so much for the help!

I love this place :)
 
Back
Top