Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Sending an e-mail

Status
Not open for further replies.

JaneB19

Technical User
Jun 27, 2002
110
GB
Hi,
I'm trying to send an automated e-mail if a radio button value is true. I've compared my coding to tutorial web sites and other sources!

My coding goes as follows

<% If request.form(&quot;HSEIncidentOccurrance&quot;) = &quot;TRUE&quot; Then
Dim myMail
Set myMail = Server.CreateObject(&quot;CDONTS.NewMail&quot;) myMail.From = &quot;e-mail address&quot;
myMail.To = &quot;recipient&quot;
myMail.Subject = &quot;HSE Incident Occurrance&quot;
myMail.Body = &quot;blah blah blah&quot;
myMail.Send

Set myMail = Nothing
End If
%>

I've tried the coding with CDO instead of CDONST and changed the variables accordingly.

Can anybody see, or know why it's not working? I've spent the last week and a bit on it!

Thanks
:)

[PC2]
 
Try removing (= &quot;TRUE&quot;) the default is true anyway and you shouldnt have to use the &quot;&quot; either.

moley
 
Any luck with moley's idea?

I'd put:

Response.write(&quot;If statement succeeded&quot;)

between the &quot;if&quot; condition and dim line, then you'll know that the if statement and radio value works, even if the email doesn't send or work.

If moleys idea doesn't work post the code that sends to this page.

Mark
 
Hi guys!

Unfortunately Moley's idea didn't work.

Sorry Mark but what do you mean post the code that sends? If it's the code that sends the e-mail it's on my original post.

Thanks

Jane :)

[PC2]
 
Sorry - Post the code in the previous page, with the form tags and the radio form elements.

Mark
 
Are you testing this on a server configured for cdonts?? you have to test the page using the http address not c:\blah etc, try it from your PWS or IIS depending on your system.

if not sure try this code, if if doesnt work then its probably server issues.

Dim objMail
Set objMail = Server.CreateObject(&quot;CDONTS.NewMail&quot;)

HTML =&quot;<HTML>insert stuff</HTML>&quot;

objMail.From = &quot;myaddress@blah.co.uk&quot;
objMail.Subject = &quot;Message&quot;

objMail.BodyFormat = 0
objMail.MailFormat = 0

objMail.To = email
objMail.Body = HTML
objMail.Send
set objMail = nothing
close.rsPass
set rsPass = nothing
close.rsEmail
set rsEmail = nothing
%>
 
Sorry Mark, I'm just trying Moley's 2nd idea at the moment. I can only post the radio button coding, rather than the whole page as it contains private information for the company I'm working for! :)

Err, yeah I'm testing my pages through IIS. I tried the e-mail function with CDO.

I'm having a slight problem with your coding. The close.rsPass is bring up an error, but I can't see where it's been opened. Or not as the case might be (as far as I can tell)? Also not sure about the reEmail, I'm not too sure why they are included? ::)

[PC2]
 
Jane,

Just a thought but are you seeing an error? If not then it might be that the CDONTS code is working and creating the email, but the SMTP Server isn't working. You could check to see if there are emails waiting to go under the mailroot directory on the web server.
 
<TR>
HSE Incident Occurrance:
<BR>
<INPUT TYPE=&quot;radio&quot; NAME=&quot;HSEIncidentOccurrance&quot; VALUE=&quot;TRUE&quot;> Yes
<INPUT TYPE=&quot;radio&quot; NAME=&quot;HSEIncidentOccurrance&quot; VALUE=&quot;FALSE&quot;> No
</TR>

I hope that this is of some help Mark :)

[PC2]
 
Welcome DomPedro! [wavey2]

No, I wasn't getting an error originally, and when I take out the rsMail and the rsPass I don't get an error either!

How do I check that there are e-mails waiting on the web server?

Probably sounds like a silly/stupid question, sorry if it is!

Thank you

[PC2]
 
DomPedro, you were correct! :) I realised once I'd posted the last message where to look for the unsent e-mails.

Next question would be, how do I get it to send the e-mail rather than Queuing them?!

:)

[PC2]
 
# Steps to Configure your Internet Information Server (IIS). In order to send mail from your IIS server via your SMTP server (assuming that they are different computers), complete the following steps:

1. On your IIS computer, open the Microsoft Management Console (MMC).
2. In the left pane, expand the &quot;Internet Information Server&quot; section.
3. In the left pane, select and expand your IIS server.
4. In the right pane, right-click &quot;Default SMTP server&quot; and select &quot;Properties&quot;
5. Select the &quot;Delivery&quot; tab.
6. In the &quot;Fully Qualified Domain Name&quot; text box, enter the IIS computer name.
7. In the &quot;Smart Host&quot; text box, enter the name of your SMTP server.

I suggest following this and seeing if it is already set.
then go to which this configuration comes from and copy/paste the example there. run it and see what happens.
First debug CDONTS/SMTP and then debug your code. That step process may get you farther faster

____________________________________________________
The most important part of your thread is the subject line.
Make it clear and about the topic so we can find it later for reference. Please!! faq333-3811

onpnt2.gif
 
Me again!

Just to say thank you for your help last week. I'm still waiting for IT to get back to me about the name of our Smart Host. I won't be holding my breath!

Thanks again

Jane :)

[PC2]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top