Click here to Skip to main content
15,922,155 members
Home / Discussions / ASP.NET
   

ASP.NET

 
GeneralRe: what is viewstate ? Pin
Mohammed Amine19-Jun-06 23:34
Mohammed Amine19-Jun-06 23:34 
GeneralRe: what is viewstate ? Pin
varshavmane19-Jun-06 23:43
varshavmane19-Jun-06 23:43 
GeneralRe: what is viewstate ? Pin
Mohammed Amine19-Jun-06 23:46
Mohammed Amine19-Jun-06 23:46 
QuestionHow to replace apostrophes? [modified] Pin
Goalie3519-Jun-06 11:31
Goalie3519-Jun-06 11:31 
AnswerRe: How to replace apostrophes? Pin
pmpdesign19-Jun-06 14:01
pmpdesign19-Jun-06 14:01 
AnswerRe: How to replace apostrophes? Pin
Guffa19-Jun-06 20:48
Guffa19-Jun-06 20:48 
Questionjavascript problem in webpart [modified] Pin
Dhruvil19-Jun-06 10:52
Dhruvil19-Jun-06 10:52 
QuestionEmail problem with ASP.NET 2.0 (VB) Pin
Keith Goddard19-Jun-06 10:25
Keith Goddard19-Jun-06 10:25 
Hi
Sorry to bother you guys but this is driving me nuts. I'm trying to retrieve a list of email addresses from a database, and send an email to all those addresses. For testing purposes, the database contains 1 address, mine. Code below (with senstivie bits *** out)

Protected Sub btnSend_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnSend.Click
If Page.IsValid Then
Dim strSQL As String
Dim MyConn As Data.SqlClient.SqlConnection
MyConn = New Data.SqlClient.SqlConnection(ConfigurationManager.ConnectionStrings("ConnectionString").ConnectionString)


Dim strBody As String
Dim Msg As New System.Net.Mail.MailMessage
Dim MailObj As New System.Net.Mail.SmtpClient()

'retrieve list of email address,IDs etc
strSQL = "Select * From vwNewsLetterList"

Dim objDR As Data.SqlClient.SqlDataReader
Dim Cmd As New Data.SqlClient.SqlCommand(strSQL, MyConn)
MyConn.Open()
objDR = Cmd.ExecuteReader(System.Data.CommandBehavior.CloseConnection)

'loop thru data, construct the message and send it
While objDR.Read()

strBody = txtMessage.Text

Msg.IsBodyHtml = True
Msg.Subject = "Test email"
MailObj.Host = "mail.*****.net"

Msg.From = New System.Net.Mail.MailAddress("*@*.net")

Msg.To.Add(New System.Net.Mail.MailAddress(objDR("Email")))
Msg.Body = strBody

MailObj.Send(Msg)

End While
MyConn.Close()

End If
End Sub



The code excutes with no errors, but... immediately afterwards I see my virus scanner going, and when I check my mail I get an "Undelivered Mail Returned to Sender" message from my virus checker, with the following info:

I'm sorry to have to inform you that the message returned
below could not be delivered to one or more destinations.

-------------------------------------------------------------------
*******@*****.com: sorry, that domain isn't allowed to be relayed thru this MTA (#5.7.1)
-------------------------------------------------------------------

Your e-mail message is being returned to you in the next part of this
message. Try to send the message again.



It seems as if the code is trying to send the message through my personal email server rather than the smpt client specified in the code. What am I doing wrong? Oh, and by the way... if I use "traditonal" ASP and specifiy this Smtp client, it works perfectly.

AnswerRe: Email problem with ASP.NET 2.0 (VB) Pin
smita_roy19-Jun-06 19:35
smita_roy19-Jun-06 19:35 
GeneralRe: Email problem with ASP.NET 2.0 (VB) Pin
Keith Goddard20-Jun-06 11:34
Keith Goddard20-Jun-06 11:34 
Questioncan you help me do ma first web page please ? Pin
Mohammed Amine19-Jun-06 9:24
Mohammed Amine19-Jun-06 9:24 
AnswerRe: can you help me do ma first web page please ? Pin
Joshua Lunsford19-Jun-06 10:52
Joshua Lunsford19-Jun-06 10:52 
GeneralRe: can you help me do ma first web page please ? Pin
Mohammed Amine19-Jun-06 11:52
Mohammed Amine19-Jun-06 11:52 
QuestionDeploying SQL .MDF File [modified] Pin
emran83419-Jun-06 9:08
emran83419-Jun-06 9:08 
AnswerRe: Deploying SQL .MDF File Pin
Joshua Lunsford19-Jun-06 10:55
Joshua Lunsford19-Jun-06 10:55 
QuestionSiteMap + roles issue [modified] Pin
eggsovereasy19-Jun-06 8:51
eggsovereasy19-Jun-06 8:51 
AnswerRe: SiteMap + roles issue Pin
minhpc_bk19-Jun-06 10:39
minhpc_bk19-Jun-06 10:39 
GeneralRe: SiteMap + roles issue Pin
eggsovereasy19-Jun-06 11:02
eggsovereasy19-Jun-06 11:02 
AnswerRe: SiteMap + roles issue Pin
sasi bhushan19-Jun-06 18:37
sasi bhushan19-Jun-06 18:37 
QuestionButton Event Pin
cppdotnet19-Jun-06 7:51
cppdotnet19-Jun-06 7:51 
AnswerRe: Button Event Pin
eggsovereasy19-Jun-06 8:55
eggsovereasy19-Jun-06 8:55 
GeneralRe: Button Event Pin
cppdotnet20-Jun-06 3:09
cppdotnet20-Jun-06 3:09 
GeneralRe: Button Event Pin
Guffa19-Jun-06 16:53
Guffa19-Jun-06 16:53 
QuestionNested datagrids; one edit? Pin
leckey19-Jun-06 7:11
leckey19-Jun-06 7:11 
AnswerRe: Nested datagrids; one edit? Pin
Sebastien Lachance19-Jun-06 8:56
Sebastien Lachance19-Jun-06 8:56 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.