Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

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:

 

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

  • Moderators
Posted
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
Visit...Bassic Software
Posted

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 :

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

"If someone say : "Die mortal !"... don't stay to see if he isn't." - Unknown

"Learning to program is like going out with a new girl friend. There's always something that wasn't mentioned in the documentation..." - Me

"A drunk girl is like an animal... it scream at everything like a cat and roll in the grass like a dog." - Me after seeing my girlfriend drunk and some of her drunk friend.

C# TO VB TRANSLATOR

Posted
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 :

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 :)

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...