Click here to Skip to main content
15,897,371 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am writing a code which send Email to the respective email address. First time its working fine. But after sending my first email its not accept my program and I am not able to send email again. I put the code snippet here.


Dim smtpServer As New SmtpClient
Dim messageSTR As New MailMessage
Dim strAddress As New MailAddress("Email address", "Name") 

messageSTR.From = strAddress 
messageSTR.To.Add("To Email Address")
messageSTR.Subject = Me.txtSub.Text
messageSTR.Body = Me.txtMailBody.Text

smtpServer.Host = "smtp.gmail.com" 
smtpServer.Port = 578 

smtpServer.Credentials = New NetworkCredential("user id", "user pass")

smtpServer.EnableSsl = true
smtpServer.Send(messageSTR)



What is the problem? Why I don't send the second mail?
Posted
Updated 1-Jan-10 5:57am
v2

1 solution

Do you relogin every time when you send mail?

GMail is public Email SMTP, so there may be some ruleset applied to remove SPAM.
It would be better for me to understand the actual error if you can give me what error message you are getting.

My application seems to work perfectly :
How to Send Mails from your GMAIL Account through VB.NET or C#. Windows Programming, with a Bit of Customization[^]

It can send more than one messages. I think the code is similar to yours. :sigh:
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900