ASP Hosting sale!
Double disk space and transfer for FREE!
Limited time offer! Act Now!

aspdev | articles | tutorials | forums

 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

ASP email - CDOSYS or CDONTS?
Goto page Previous  1, 2
 
Post new topic   Reply to topic    ASPdev.org Forum Index -> ASP programming
View previous topic :: View next topic  
Author Message
paul



Joined: 11 Oct 2004
Posts: 128

PostPosted: Fri Feb 03, 2006 6:04 pm    Post subject: Reply with quote

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
View user's profile Send private message
Patrickh60



Joined: 01 Feb 2006
Posts: 14
Location: Anaheim, CA

PostPosted: Fri Feb 03, 2006 6:22 pm    Post subject: Success Reply with quote

Paul,

The sample page works fine. Successful transmission to my outside email account.

Now, how do I get this checklist working? Confused

Thanks for your & Pete's assistance. I forgot how frustrating coding is.

Pat
_________________
pathuber@protectall.com
www.protectall.com
Back to top
View user's profile Send private message Send e-mail Visit poster's website
administrator
Site Admin


Joined: 01 Oct 2004
Posts: 183

PostPosted: Fri Feb 03, 2006 9:26 pm    Post subject: Reply with quote

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
View user's profile Send private message
Patrickh60



Joined: 01 Feb 2006
Posts: 14
Location: Anaheim, CA

PostPosted: Mon Feb 06, 2006 7:01 pm    Post subject: Ouch! Reply with quote

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 Very Happy

Pat
_________________
pathuber@protectall.com
www.protectall.com
Back to top
View user's profile Send private message Send e-mail Visit poster's website
administrator
Site Admin


Joined: 01 Oct 2004
Posts: 183

PostPosted: Tue Feb 07, 2006 9:59 am    Post subject: Reply with quote

Hi Pat,

So we finally know what's wrong Smile.
You'll have to fix the composition of the email TO list.




Peter
_________________
Peter
ASP & ASP.NET Articles and Tutorials
Back to top
View user's profile Send private message
Patrickh60



Joined: 01 Feb 2006
Posts: 14
Location: Anaheim, CA

PostPosted: Tue Feb 07, 2006 11:57 am    Post subject: And? Reply with quote

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
View user's profile Send private message Send e-mail Visit poster's website
administrator
Site Admin


Joined: 01 Oct 2004
Posts: 183

PostPosted: Wed Feb 08, 2006 11:15 pm    Post subject: Reply with quote

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
View user's profile Send private message
Patrickh60



Joined: 01 Feb 2006
Posts: 14
Location: Anaheim, CA

PostPosted: Thu Feb 09, 2006 6:41 pm    Post subject: What? Reply with quote

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
View user's profile Send private message Send e-mail Visit poster's website
administrator
Site Admin


Joined: 01 Oct 2004
Posts: 183

PostPosted: Thu Feb 09, 2006 9:01 pm    Post subject: Reply with quote

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
View user's profile Send private message
Patrickh60



Joined: 01 Feb 2006
Posts: 14
Location: Anaheim, CA

PostPosted: Fri Feb 10, 2006 1:01 pm    Post subject: Thanks Again Reply with quote

Thanks, Peter!

I'll give that a try.

Pat
_________________
pathuber@protectall.com
www.protectall.com
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Patrickh60



Joined: 01 Feb 2006
Posts: 14
Location: Anaheim, CA

PostPosted: Fri Feb 10, 2006 1:39 pm    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail Visit poster's website
administrator
Site Admin


Joined: 01 Oct 2004
Posts: 183

PostPosted: Fri Feb 10, 2006 3:58 pm    Post subject: Reply with quote

This is an easy one Smile

Comment the following line:

Response.End
_________________
Peter
ASP & ASP.NET Articles and Tutorials
Back to top
View user's profile Send private message
administrator
Site Admin


Joined: 01 Oct 2004
Posts: 183

PostPosted: Fri Feb 10, 2006 3:59 pm    Post subject: Reply with quote

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
View user's profile Send private message
Patrickh60



Joined: 01 Feb 2006
Posts: 14
Location: Anaheim, CA

PostPosted: Fri Feb 10, 2006 5:16 pm    Post subject: Getting Closer Reply with quote

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
View user's profile Send private message Send e-mail Visit poster's website
administrator
Site Admin


Joined: 01 Oct 2004
Posts: 183

PostPosted: Sat Feb 11, 2006 9:21 pm    Post subject: Reply with quote

Thanks Patrick,

I'm glad it worked out.
_________________
Peter
ASP & ASP.NET Articles and Tutorials
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    ASPdev.org Forum Index -> ASP programming All times are GMT - 5 Hours
Goto page Previous  1, 2
Page 2 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2002 phpBB Group

SQL Tutorial