?
Solved

Why this code does not send email?

Posted on 2011-10-11
4
Medium Priority
?
278 Views
Last Modified: 2012-06-27
Hi, can someone figure out what is wrong(s) with this code, it does not send email?(Im using .NET 2 framework)

Protected Sub SendEmail(ByVal strError As String, ByVal file As String)

        Dim MyConnection As New SqlConnection(Configuration.ConfigurationSettings.AppSettings("ConnStr"))
        Dim MyCommand As New SqlCommand("GetAutoEmails", MyConnection)
        Dim dr As SqlDataReader
        Try
            'English News
            '---------------------------------------------------------------------'
            MyCommand.CommandType = CommandType.StoredProcedure
            MyCommand.Parameters.Add("@module", "UpdateRSS")
            MyConnection.Open()
            dr = MyCommand.ExecuteReader(CommandBehavior.Default)

            '(1) Create the MailMessage instance
            Dim mm As New Mail.MailMessage()

            '(2) Assign the MailMessage's properties
            mm.Subject = "Xml feed error"
            mm.Body = "Please check RSS they are not updated, got errors in the following file:" + file + "<br>" + strError
            mm.From = "tech@menafn.com"
            Dim strTo As String = ""
            While dr.Read
                strTo = strTo + ";" + dr("ae_email")

            End While
            mm.To = strTo
            Mail.SmtpMail.Send(mm)

        Catch ex As Exception
            Response.Write("Error..." + ex.Message + "<br><br>")
        End Try
    End Sub

Open in new window



and here is the webconfig:

<system.net>
		<mailSettings>
			<smtp>
				<network
			                 host="dedrelay.secureservers.net"
					 port="25" />
			</smtp>
		</mailSettings>
	</system.net>

Open in new window

0
Comment
Question by:Sindibad_123
  • 2
4 Comments
 

Author Comment

by:Sindibad_123
ID: 36950588
Anyone! It's around 4 hours passed and still did not get any answer!
0
 
LVL 96

Assisted Solution

by:Bob Learned
Bob Learned earned 600 total points
ID: 36953235
Are there any exceptions?  Have you configured the SmtpClient correctly for dedrelay.secureservers.net?
0
 

Author Comment

by:Sindibad_123
ID: 36953829
I got this exception:
"The "SendUsing" configuration value is invalid"
0
 
LVL 26

Accepted Solution

by:
Anurag Thakur earned 1400 total points
ID: 36953911
check this one out
the following site is the google of sending mails from asp.net
http://www.systemwebmail.com/faq/4.2.2.aspx
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Today is the age of broadband.  More and more people are going this route determined to experience the web and it’s multitude of services as quickly and painlessly as possible. Coupled with the move to broadband, people are experiencing the web via …
Introduction This article shows how to use the open source plupload control to upload multiple images. The images are resized on the client side before uploading and the upload is done in chunks. Background I had to provide a way for user…
Loops Section Overview
Despite its rising prevalence in the business world, "the cloud" is still misunderstood. Some companies still believe common misconceptions about lack of security in cloud solutions and many misuses of cloud storage options still occur every day. …
Suggested Courses
Course of the Month13 days, 20 hours left to enroll

809 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question