View previous topic :: View next topic |
Author |
Message |
paul
Joined: 11 Oct 2004 Posts: 128
|
Posted: Fri Feb 03, 2006 6:04 pm Post subject: |
|
|
Patrick,
Do you have SMTP ser ver running on your local box?
The "The transport failed to connect to the server." error usually comes up when the SMTP server is not running.
The easiest thing to do is to try the ASP.NET example as it is (with single recipient). If it does work there is a problem with the email string. If it doesn't then post the error and we'll try to fix it.
How does this sound?
Paul _________________ World Countries | Survival Skills |
|
Back to top |
|
|
Patrickh60
Joined: 01 Feb 2006 Posts: 14 Location: Anaheim, CA
|
Posted: Fri Feb 03, 2006 6:22 pm Post subject: Success |
|
|
Paul,
The sample page works fine. Successful transmission to my outside email account.
Now, how do I get this checklist working?
Thanks for your & Pete's assistance. I forgot how frustrating coding is.
Pat _________________ pathuber@protectall.com
www.protectall.com |
|
Back to top |
|
|
administrator Site Admin
Joined: 01 Oct 2004 Posts: 183
|
Posted: Fri Feb 03, 2006 9:26 pm Post subject: |
|
|
Patrickh60 wrote: | administrator wrote: | Hi Patrick,
Sorry for the late reply.
Can you please print the value of email, with the following code:
Response.Write("[ " & email & " ]")
|
Peter,
I must be too far out-of-practice. More errors involving this line.
Compiler Error Message: BC30451: Name 'email' is not declared.
Source Error:
Line 72: </form>
Line 73: <script>
Line 74: <%Response.Write("[ " & email & " ]")%>
Line 75: </script> |
Patrick,
You got the error above, because you tried to print the email variable, which is declared within the Page_Load subroutine.
Please insert the following 2 lines:
Response.Write("[ " & email & " ]")
Response.End
immediately after the following lines:
for each email_addy in Request.Form("email_addy")
email = email & email_addy & "; "
next
Run the page and post the printed result here.
Thanks,
Peter _________________ Peter
ASP & ASP.NET Articles and Tutorials |
|
Back to top |
|
|
Patrickh60
Joined: 01 Feb 2006 Posts: 14 Location: Anaheim, CA
|
Posted: Mon Feb 06, 2006 7:01 pm Post subject: Ouch! |
|
|
Peter,
This is interesting:
[ p; a; t; h; u; b; e; r; @; p; a; c; b; e; l; l; .; n; e; t; ,; p; a; t; h; u; b; e; r; @; p; r; o; t; e; c; t; a; l; l; .; c; o; m; ]
That's my output. h
Pat _________________ pathuber@protectall.com
www.protectall.com |
|
Back to top |
|
|
administrator Site Admin
Joined: 01 Oct 2004 Posts: 183
|
Posted: Tue Feb 07, 2006 9:59 am Post subject: |
|
|
Hi Pat,
So we finally know what's wrong .
You'll have to fix the composition of the email TO list.
Peter _________________ Peter
ASP & ASP.NET Articles and Tutorials |
|
Back to top |
|
|
Patrickh60
Joined: 01 Feb 2006 Posts: 14 Location: Anaheim, CA
|
Posted: Tue Feb 07, 2006 11:57 am Post subject: And? |
|
|
Peter,
What is your suggestion as to how to fix this? I don't see why it's inserting a semi-colon between each letter. _________________ pathuber@protectall.com
www.protectall.com |
|
Back to top |
|
|
administrator Site Admin
Joined: 01 Oct 2004 Posts: 183
|
Posted: Wed Feb 08, 2006 11:15 pm Post subject: |
|
|
Pat,
You can put numbering in the checkboxes' names like this:
<input type="checkbox" name="email1" value="info@aaa.com">
info@aaa.com<br />
<input type="checkbox" name="email2" value="info@bbb.com">
info@bbb.com<br />
<input type="checkbox" name="email3" value="info@ccc.com">
info@ccc.com <br />
and then just concatenate Request("email1"), Request("email2"), etc. _________________ Peter
ASP & ASP.NET Articles and Tutorials |
|
Back to top |
|
|
Patrickh60
Joined: 01 Feb 2006 Posts: 14 Location: Anaheim, CA
|
Posted: Thu Feb 09, 2006 6:41 pm Post subject: What? |
|
|
administrator wrote: | Pat,
You can put numbering in the checkboxes' names like this:
<input type="checkbox" name="email1" value="info@aaa.com">
info@aaa.com<br />
<input type="checkbox" name="email2" value="info@bbb.com">
info@bbb.com<br />
<input type="checkbox" name="email3" value="info@ccc.com">
info@ccc.com <br />
and then just concatenate Request("email1"), Request("email2"), etc. |
You've lost me. _________________ pathuber@protectall.com
www.protectall.com |
|
Back to top |
|
|
administrator Site Admin
Joined: 01 Oct 2004 Posts: 183
|
Posted: Thu Feb 09, 2006 9:01 pm Post subject: |
|
|
Something like that:
Code: |
<input type="checkbox" name="email1" value="info@aaa.com">
info@aaa.com<br />
<input type="checkbox" name="email2" value="info@bbb.com">
info@bbb.com<br />
<input type="checkbox" name="email3" value="info@ccc.com">
info@ccc.com <br />
<%
If Request("email1") <> '' Then
email = email & Request("email1") & ";"
End If
If Request("email2") <> '' Then
email = email & Request("email2") & ";"
End If
If Request("email3") <> '' Then
email = email & Request("email3") & ";"
End If
%>
|
Does it make sense? _________________ Peter
ASP & ASP.NET Articles and Tutorials |
|
Back to top |
|
|
Patrickh60
Joined: 01 Feb 2006 Posts: 14 Location: Anaheim, CA
|
|
Back to top |
|
|
Patrickh60
Joined: 01 Feb 2006 Posts: 14 Location: Anaheim, CA
|
Posted: Fri Feb 10, 2006 1:39 pm Post subject: |
|
|
Code: |
Sub Page_Load(Sender as Object, E as EventArgs)
If Page.IsPostBack Then
lblResponse.Text = "Your email has been sent."
End If
End Sub
Sub btn_Click(sender as Object, e as System.EventArgs)
Dim email
'Dim email_addy
' email = ""
' for each email_addy in Request.Form("email_addy")
' email = email & email_addy & "; "
'next
If Request("email1") <> "" Then
email = email & Request("email1") & ";"
End If
If Request("email2") <> "" Then
email = email & Request("email2") & ";"
End If
If Request("email3") <> "" Then
email = email & Request("email3") & ";"
End If
If Request("email4") <> "" Then
email = email & Request("email4") & ";"
End If
Response.Write("[ " & email & " ]")
Response.End
'If Request.Form("email") <> "" Then
'If email <> "" Then
'If Request("email") <> "" Then
Dim objMail As New MailMessage()
objMail.From = "pathuber@protectall.com"
objMail.To = email
objMail.Subject = Request.Form("Subject")
objMail.Body = Request.Form("Message")
objMail.BodyFormat = MailFormat.Text
SmtpMail.SmtpServer = "localhost"
SmtpMail.Send(objMail)
'Else
'lblResponse.Text = "Please enter an email address."
'End If
End Sub |
Ok, I commented out the original concatenation of the email addresses. Numbered the email addresses. Inserted the code you supplied to concatenate the email addresses again.
Testing shows the email addresses are in the value for "email." So there's success that far.
Then I tried several options to send, all with no success. I substituted different things in the If statement at the start of the section putting the email together. In this final version here, I tried going without the If statement altogether.
Long story short, I'm getting the right values now but it's not being sent.
Where'd I go wrong this time?
Thanks,
Pat _________________ pathuber@protectall.com
www.protectall.com |
|
Back to top |
|
|
administrator Site Admin
Joined: 01 Oct 2004 Posts: 183
|
|
Back to top |
|
|
administrator Site Admin
Joined: 01 Oct 2004 Posts: 183
|
Posted: Fri Feb 10, 2006 3:59 pm Post subject: |
|
|
I forgot something. You still need to check if the email variable is not empty (user has not selected any of the check boxes). If the email variable is empty and you try to send the email you'll get an error again. _________________ Peter
ASP & ASP.NET Articles and Tutorials |
|
Back to top |
|
|
Patrickh60
Joined: 01 Feb 2006 Posts: 14 Location: Anaheim, CA
|
Posted: Fri Feb 10, 2006 5:16 pm Post subject: Getting Closer |
|
|
Thanks, Peter!
Now I have to find a server to test from. Works fine on my desktop, although it isn't mailing through to our Exchange Server. But I get the email on my laptop just fine.
Thanks for your assistance.
Patrick _________________ pathuber@protectall.com
www.protectall.com |
|
Back to top |
|
|
administrator Site Admin
Joined: 01 Oct 2004 Posts: 183
|
|
Back to top |
|
|
|