By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,647 Members | 1,588 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,647 IT Pros & Developers. It's quick & easy.

Generate email when I click button?

P: n/a
When I click "save" after adding a new record (which contains, among other
fields, the person's email address), I want an email to automatically be sent
to that person (at the email that is in the field of that record). How can I
do this?

Thanks so much, it really means so much to me!!!

--
Message posted via WebmasterKB.com
http://www.webmasterkb.com/Uwe/Forums.aspx/asp/200710/1

Oct 11 '07 #1
Share this Question
Share on Google+
34 Replies


P: n/a
"majahops via WebmasterKB.com" <u37541@uwewrote in message
news:798bc3f05f9b3@uwe...
When I click "save" after adding a new record (which contains, among other
fields, the person's email address), I want an email to automatically be
sent
to that person (at the email that is in the field of that record). How can
I
do this?
What does your Web host support?
Perhaps, CDO.Message or ASPMail.

Oct 11 '07 #2

P: n/a
First off, thank you SO much for responding - it mean's a lot to me - i've
been trying to get this done forever.

So I have godaddy.com. When I look up what they support, I get the following:
CDO.MESSAGE
CDONTS.NewMail

I'm assuming that means that godaddy.com supports CDO.Message.

Thank you so so so so so much again. My heart skipped a beat when I saw that
somebody had finally [at least tried] to answer my cries for help.

Tim
McKirahan wrote:
>When I click "save" after adding a new record (which contains, among other
fields, the person's email address), I want an email to automatically be sent
to that person (at the email that is in the field of that record). How can I
do this?

What does your Web host support?
Perhaps, CDO.Message or ASPMail.
--
Message posted via WebmasterKB.com
http://www.webmasterkb.com/Uwe/Forums.aspx/asp/200710/1

Oct 11 '07 #3

P: n/a
"majahops via WebmasterKB.com" <u37541@uwewrote in message
news:798cc27bb482e@uwe...
First off, thank you SO much for responding - it mean's a lot to me - i've
been trying to get this done forever.

So I have godaddy.com. When I look up what they support, I get the
following:
>

CDO.MESSAGE
CDONTS.NewMail

I'm assuming that means that godaddy.com supports CDO.Message.
[snip]

Try this; watch for word-wrap.

The Response.Write() statement invokes the function;
modify it to suit your needs. Just call the function by
passing in 3 parms: email address, subject, and body.

The value of "cHST" (Host) is what GoDaddy requires.
The value of "cFRM" (From) is your email address.

Suucess/failure reporting has been commented out as
you may want to log the results rather than display them.

<%@ Language="VBScript" %>
<% Option Explicit

Response.Write("Email = " & Email("ne**@mckirahan.com","Test","Test!"))

Function Email(sAddr,sSubj,sBody)
Email = False
On Error Resume Next
'*
'* Declare Constants
'*
Const cCDO = "http://schemas.microsoft.com/cdo/configuration/"
Const cHST = "relay-hosting.secureserver.net"
Const cFRM = "postmaster@{your~domain.com}"
'*
'* Send Email
'*
Dim objCFG
Set objCFG = Server.CreateObject("CDO.Configuration")
objCFG.Fields.Item(cCDO & "sendusing") = 2
objCFG.Fields.Item(cCDO & "smtpserver") = cHST
objCFG.Fields.Item(cCDO & "smtpserverport") = 25
objCFG.Fields.Update
Dim objCDO
Set objCDO = Server.CreateObject("CDO.Message")
objCDO.From = cFRM
objCDO.To = sAddr
'objCDO.BCC = ""
'objCDO.CC = ""
objCDO.Subject = sSubj
objCDO.TextBody = sBody
'objCDO.HTMLBody = sBody
'objCDO.AddAttachment = ""
objCDO.Configuration = objCFG
objCDO.Send
' If Err = 0 Then
' Response.Write("<br><br><b>E-mail has been sent.</b>")
' Else
' Response.Write("<br><b>Sub Email()</b>")
' Response.Write("<br><b>CDO Failed:</b" & Err.Description)
' Response.Write("<br><b>CDO 'Addr':</b" & sAddr)
' Response.Write("<br><b>CDO 'Subj':</b" & sSubj)
' Response.Write("<br><b>CDO 'Body':</b" & sBody)
' End If
Set objCDO = Nothing
Set objCFG = Nothing
'*
'* Return
'*
On Error GoTo 0
Email = True
End Function
%>
Oct 11 '07 #4

P: n/a
McKirahan,

Before I do this, where do I put all of this text? That has been one of the
things that is unclear to me. Do I put it next to the like where the save-
button is in the html, or what? Thanks so much again!

McKirahan wrote:
>First off, thank you SO much for responding - it mean's a lot to me - i've
been trying to get this done forever.
[quoted text clipped - 5 lines]
>>
I'm assuming that means that godaddy.com supports CDO.Message.

[snip]

Try this; watch for word-wrap.

The Response.Write() statement invokes the function;
modify it to suit your needs. Just call the function by
passing in 3 parms: email address, subject, and body.

The value of "cHST" (Host) is what GoDaddy requires.
The value of "cFRM" (From) is your email address.

Suucess/failure reporting has been commented out as
you may want to log the results rather than display them.

<%@ Language="VBScript" %>
<% Option Explicit

Response.Write("Email = " & Email("ne**@mckirahan.com","Test","Test!"))

Function Email(sAddr,sSubj,sBody)
Email = False
On Error Resume Next
'*
'* Declare Constants
'*
Const cCDO = "http://schemas.microsoft.com/cdo/configuration/"
Const cHST = "relay-hosting.secureserver.net"
Const cFRM = "postmaster@{your~domain.com}"
'*
'* Send Email
'*
Dim objCFG
Set objCFG = Server.CreateObject("CDO.Configuration")
objCFG.Fields.Item(cCDO & "sendusing") = 2
objCFG.Fields.Item(cCDO & "smtpserver") = cHST
objCFG.Fields.Item(cCDO & "smtpserverport") = 25
objCFG.Fields.Update
Dim objCDO
Set objCDO = Server.CreateObject("CDO.Message")
objCDO.From = cFRM
objCDO.To = sAddr
'objCDO.BCC = ""
'objCDO.CC = ""
objCDO.Subject = sSubj
objCDO.TextBody = sBody
'objCDO.HTMLBody = sBody
'objCDO.AddAttachment = ""
objCDO.Configuration = objCFG
objCDO.Send
' If Err = 0 Then
' Response.Write("<br><br><b>E-mail has been sent.</b>")
' Else
' Response.Write("<br><b>Sub Email()</b>")
' Response.Write("<br><b>CDO Failed:</b" & Err.Description)
' Response.Write("<br><b>CDO 'Addr':</b" & sAddr)
' Response.Write("<br><b>CDO 'Subj':</b" & sSubj)
' Response.Write("<br><b>CDO 'Body':</b" & sBody)
' End If
Set objCDO = Nothing
Set objCFG = Nothing
'*
'* Return
'*
On Error GoTo 0
Email = True
End Function
%>
--
Message posted via WebmasterKB.com
http://www.webmasterkb.com/Uwe/Forums.aspx/asp/200710/1

Oct 11 '07 #5

P: n/a
Here is the area of html around the save button (plus some more)...where
would i put the part you gave me into this? Thanks so much again!!!

<TD class=shade style="BACKGROUND-COLOR: #e6e6fa" width=172>
<P align=right>SPID</P></TD>
<TD width=240>{build_edit_control field="SPID" mode="add" value=
$value_SPID} </TD></TR>
<TR height=50>
<TD style="BACKGROUND-COLOR: #e6e6fa" align=middle width=414
colSpan=2><INPUT class=button id=submit1 type=submit value=Save name=submit1>

<INPUT class=button type=reset value=Reset<input type=hidden name="a"
value="added"></TD></TR></FORM><!-- legend -->
<TR height=50>
<TD style="BACKGROUND-COLOR: #e6e6fa" align=left width=414 colSpan=2>
<HR width=400 noShade SIZE=1>
<BR><IMG src="images/icon_required.gif"- Required field
</TD></TR></TBODY></TABLE>{include_if_exists file="include/footer.asp"} {
$linkdata}<script>SetToFirstControl();</script></BODY></HTML>
McKirahan wrote:
>First off, thank you SO much for responding - it mean's a lot to me - i've
been trying to get this done forever.
[quoted text clipped - 5 lines]
>>
I'm assuming that means that godaddy.com supports CDO.Message.

[snip]

Try this; watch for word-wrap.

The Response.Write() statement invokes the function;
modify it to suit your needs. Just call the function by
passing in 3 parms: email address, subject, and body.

The value of "cHST" (Host) is what GoDaddy requires.
The value of "cFRM" (From) is your email address.

Suucess/failure reporting has been commented out as
you may want to log the results rather than display them.

<%@ Language="VBScript" %>
<% Option Explicit

Response.Write("Email = " & Email("ne**@mckirahan.com","Test","Test!"))

Function Email(sAddr,sSubj,sBody)
Email = False
On Error Resume Next
'*
'* Declare Constants
'*
Const cCDO = "http://schemas.microsoft.com/cdo/configuration/"
Const cHST = "relay-hosting.secureserver.net"
Const cFRM = "postmaster@{your~domain.com}"
'*
'* Send Email
'*
Dim objCFG
Set objCFG = Server.CreateObject("CDO.Configuration")
objCFG.Fields.Item(cCDO & "sendusing") = 2
objCFG.Fields.Item(cCDO & "smtpserver") = cHST
objCFG.Fields.Item(cCDO & "smtpserverport") = 25
objCFG.Fields.Update
Dim objCDO
Set objCDO = Server.CreateObject("CDO.Message")
objCDO.From = cFRM
objCDO.To = sAddr
'objCDO.BCC = ""
'objCDO.CC = ""
objCDO.Subject = sSubj
objCDO.TextBody = sBody
'objCDO.HTMLBody = sBody
'objCDO.AddAttachment = ""
objCDO.Configuration = objCFG
objCDO.Send
' If Err = 0 Then
' Response.Write("<br><br><b>E-mail has been sent.</b>")
' Else
' Response.Write("<br><b>Sub Email()</b>")
' Response.Write("<br><b>CDO Failed:</b" & Err.Description)
' Response.Write("<br><b>CDO 'Addr':</b" & sAddr)
' Response.Write("<br><b>CDO 'Subj':</b" & sSubj)
' Response.Write("<br><b>CDO 'Body':</b" & sBody)
' End If
Set objCDO = Nothing
Set objCFG = Nothing
'*
'* Return
'*
On Error GoTo 0
Email = True
End Function
%>
--
Message posted via WebmasterKB.com
http://www.webmasterkb.com/Uwe/Forums.aspx/asp/200710/1

Oct 11 '07 #6

P: n/a
"majahops via WebmasterKB.com" <u37541@uwewrote in message
news:798d6cf71f578@uwe...
Here is the area of html around the save button (plus some more)...where
would i put the part you gave me into this? Thanks so much again!!!

<TD class=shade style="BACKGROUND-COLOR: #e6e6fa" width=172>
<P align=right>SPID</P></TD>
<TD width=240>{build_edit_control field="SPID" mode="add" value=
$value_SPID} </TD></TR>
<TR height=50>
<TD style="BACKGROUND-COLOR: #e6e6fa" align=middle width=414
colSpan=2><INPUT class=button id=submit1 type=submit value=Save
name=submit1>
>
<INPUT class=button type=reset value=Reset<input type=hidden name="a"
value="added"></TD></TR></FORM><!-- legend -->
<TR height=50>
<TD style="BACKGROUND-COLOR: #e6e6fa" align=left width=414 colSpan=2>
<HR width=400 noShade SIZE=1>
<BR><IMG src="images/icon_required.gif"- Required field
</TD></TR></TBODY></TABLE>{include_if_exists file="include/footer.asp"} {
$linkdata}<script>SetToFirstControl();</script></BODY></HTML>
Where's your ASP code?
Oct 12 '07 #7

P: n/a
"majahops via WebmasterKB.com" <u37541@uwewrote in message
news:798d65d0832f8@uwe...
McKirahan,

Before I do this, where do I put all of this text? That has been one of
the
things that is unclear to me. Do I put it next to the like where the save-
button is in the html, or what? Thanks so much again!
[snip]

You're original post included the following statement:
>When I click "save" after adding a new record ...
What is the ASP logic behind your save button.

After the "save" call the "Email()" function.
You do know something about ASP don't you?
All ASP code is between <% and %tags unless it's "included".
Oct 12 '07 #8

P: n/a
"majahops via WebmasterKB.com" <u37541@uwewrote in message
news:798f55780afd8@uwe...
Sorry about that, here is the asp for that "Add doctor" page: Thank you
again!

[snip 2400+ lines!]
McKirahan wrote:
Here is the area of html around the save button (plus some
more)...where
would i put the part you gave me into this? Thanks so much again!!!
Where's your ASP code?
Insert the Function Email() after your ASP code but within <% and %>.

After you save the Doctor then call the "Email()" function as I
showed you in the Response.Write() statement; for example:

If Email("ne**@mckirahan.com","Test","Test!")) Then
' success
Else
' failure
End If

How do you save the Doctor?
I don't see any database code.
What database are you using?
Is the code within an "include"?
Oct 12 '07 #9

P: n/a
Is this what you mean? Thanks so much by the way.

<TD class=shade style="BACKGROUND-COLOR: #e6e6fa" width=172>
<P align=right>SPID</P></TD>

<TD width=240>{build_edit_control field="SPID" mode="add" value=
$value_SPID} </TD></TR>
<TR height=50>
<TD style="BACKGROUND-COLOR: #e6e6fa" align=middle width=414
colSpan=2><INPUT class=button id=submit1 type=submit value=Save name=submit1>

<INPUT class=button type=reset value=Reset<input type=hidden name="a"
value="added"></TD></TR></FORM><!-- legend -->
<TR height=50>
<TD style="BACKGROUND-COLOR: #e6e6fa" align=left width=414 colSpan=2>
<HR width=400 noShade SIZE=1>
<BR><IMG src="images/icon_required.gif"- Required field

</TD></TR></TBODY></TABLE>{include_if_exists file="include/footer.asp"} {
$linkdata}<script>SetToFirstControl();</script></BODY></HTML>
McKirahan wrote:
>Sorry about that, here is the asp for that "Add doctor" page: Thank you again!

[snip 2400+ lines!]
>Here is the area of html around the save button (plus some more)...where
would i put the part you gave me into this? Thanks so much again!!!

Where's your ASP code?

Insert the Function Email() after your ASP code but within <% and %>.

After you save the Doctor then call the "Email()" function as I
showed you in the Response.Write() statement; for example:

If Email("ne**@mckirahan.com","Test","Test!")) Then
' success
Else
' failure
End If

How do you save the Doctor?
I don't see any database code.
What database are you using?
Is the code within an "include"?
--
Message posted via WebmasterKB.com
http://www.webmasterkb.com/Uwe/Forums.aspx/asp/200710/1

Oct 12 '07 #10

P: n/a
McKirahan, would it be possible to email you directly?

McKirahan wrote:
>Sorry about that, here is the asp for that "Add doctor" page: Thank you again!

[snip 2400+ lines!]
>Here is the area of html around the save button (plus some more)...where
would i put the part you gave me into this? Thanks so much again!!!

Where's your ASP code?

Insert the Function Email() after your ASP code but within <% and %>.

After you save the Doctor then call the "Email()" function as I
showed you in the Response.Write() statement; for example:

If Email("ne**@mckirahan.com","Test","Test!")) Then
' success
Else
' failure
End If

How do you save the Doctor?
I don't see any database code.
What database are you using?
Is the code within an "include"?
--
Message posted via WebmasterKB.com
http://www.webmasterkb.com/Uwe/Forums.aspx/asp/200710/1

Oct 12 '07 #11

P: n/a

"majahops via WebmasterKB.com" <u37541@uwewrote in message
news:799624a4718c6@uwe...
Is this what you mean? Thanks so much by the way.
[snip]

No.
Oct 12 '07 #12

P: n/a
"majahops via WebmasterKB.com" <u37541@uwewrote in message
news:7997f7b5ea12a@uwe...
McKirahan, would it be possible to email you directly?
[snip]

Let's keep it in the newsgroup so others may benefit.
Oct 12 '07 #13

P: n/a
Thanks for trying to help, but it doesn't seem like anybody knows how to do
this when it comes down to it. I do sincerely appreciate your help though.

Tim

McKirahan wrote:
>McKirahan, would it be possible to email you directly?

[snip]

Let's keep it in the newsgroup so others may benefit.
--
Message posted via WebmasterKB.com
http://www.webmasterkb.com/Uwe/Forums.aspx/asp/200710/1

Oct 13 '07 #14

P: n/a
And what do you mean by "snip"?

majahops wrote:
>Thanks for trying to help, but it doesn't seem like anybody knows how to do
this when it comes down to it. I do sincerely appreciate your help though.

Tim
>>McKirahan, would it be possible to email you directly?

[snip]

Let's keep it in the newsgroup so others may benefit.
--
Message posted via WebmasterKB.com
http://www.webmasterkb.com/Uwe/Forums.aspx/asp/200710/1

Oct 13 '07 #15

P: n/a
"majahops via WebmasterKB.com" <u37541@uwewrote in message
news:799a4a59b76cd@uwe...
And what do you mean by "snip"?
"[snip]" indicates that lines were removed from a previous post
to avoid clutter; that is, to keep the size of the message down
as well as to allow the most relevant points to be readable
majahops wrote:
Thanks for trying to help, but it doesn't seem like anybody knows how to
do
this when it comes down to it. I do sincerely appreciate your help
though.

The "anybody" you refer to is evidently me and I do know how to
sedn email from within ASP using GoDaddy.

You haven't answered my questions about how use use ASP to
save a new Doctor so the task of helping you is difficult.

Good luck.
>McKirahan, would it be possible to email you directly?

[snip]

Let's keep it in the newsgroup so others may benefit.

Oct 13 '07 #16

P: n/a
I didn't mean to be rude, im just desperate. Can I attach/send all of my asp
and aspx files relating to this so you can see? Im sure you'll know which one
it is within a few seconds.

It'd mean a lot. thanks

Tim

McKirahan wrote:
>And what do you mean by "snip"?

"[snip]" indicates that lines were removed from a previous post
to avoid clutter; that is, to keep the size of the message down
as well as to allow the most relevant points to be readable
>Thanks for trying to help, but it doesn't seem like anybody knows how to do
this when it comes down to it. I do sincerely appreciate your help though.

The "anybody" you refer to is evidently me and I do know how to
sedn email from within ASP using GoDaddy.

You haven't answered my questions about how use use ASP to
save a new Doctor so the task of helping you is difficult.

Good luck.
>>McKirahan, would it be possible to email you directly?

[snip]

Let's keep it in the newsgroup so others may benefit.
--
Message posted via http://www.webmasterkb.com

Oct 13 '07 #17

P: n/a
"majahops via WebmasterKB.com" <u37541@uwewrote in message
news:799c0c90ad6f3@uwe...
I didn't mean to be rude, im just desperate. Can I attach/send all of my
asp
and aspx files relating to this so you can see? Im sure you'll know which
one
it is within a few seconds.

It'd mean a lot. thanks
[snip]

Is your site using ASP (.asp) or ASP.NET (.aspx) pages?

Don't send them! If you are a developer then you should be
able to figure out where my function goes and how it works.

If you're not a developer what are you doing maintaining code!

Oct 13 '07 #18

P: n/a
ASP.NET. Why, is this the wrong place for that?

McKirahan wrote:
>I didn't mean to be rude, im just desperate. Can I attach/send all of my asp
and aspx files relating to this so you can see? Im sure you'll know which one
it is within a few seconds.

It'd mean a lot. thanks

[snip]

Is your site using ASP (.asp) or ASP.NET (.aspx) pages?

Don't send them! If you are a developer then you should be
able to figure out where my function goes and how it works.

If you're not a developer what are you doing maintaining code!
--
Message posted via WebmasterKB.com
http://www.webmasterkb.com/Uwe/Forums.aspx/asp/200710/1

Oct 13 '07 #19

P: n/a
Look McKirahan,

First off, no I am not a developer. I am a clinical oncologist (cancer MD)
who is part of a small group of physicians that are trying to organize a
volunteer physician-based program that will offer free screening to the
uninsured and underinsured populations of california for prostate, breast and
other reproductive cancers.

I volunteered to work on the website (in retrospect, probably a bad idea, but
I promised I would and I need to make good on it). A program called ASPRunner
Pro was EXTREMELY useful in helping me get the basic database-layout down,
but the feature of having automatic email's sent to doctor's when I add them
to the database would be so extremely useful for us that I cannot begin to
explain.

I wish I had more time in the day to learn this language - and I have tried -
but I just never am able find out how to execute this one task.

When you first replied, you were like a godsend to us because you were going
to - in the long run - save us an extraordinary amount of time, just by
taking a few minutes to tell me how to do this one thing.

However, clearly, my profound ignorance in this area has frustrated you and
tested your patience. That is why I am begging of you, if there is anyway you
can just tell me what it is you need to see (exactly) - to help us implement
this one feature - you would be making a huge difference across the board.

Im sorry for wasting so much of your time, I truly am.
majahops wrote:
>ASP.NET. Why, is this the wrong place for that?
>>I didn't mean to be rude, im just desperate. Can I attach/send all of my asp
and aspx files relating to this so you can see? Im sure you'll know which one
[quoted text clipped - 10 lines]
>>
If you're not a developer what are you doing maintaining code!
--
Message posted via http://www.webmasterkb.com

Oct 13 '07 #20

P: n/a
"majahops via WebmasterKB.com" <u37541@uwewrote in message
news:79a3686c391d5@uwe...
ASP.NET. Why, is this the wrong place for that?
[snip]

Yes, this is a Classic ASP newsgroup.

The code I provided you before was for Classic ASP
not ASP.NET; you'll likely need something else.

Perhaps you should try this newsgroup:
microsoft.public.dotnet.framework.aspnet
Oct 13 '07 #21

P: n/a
"majahops via WebmasterKB.com" <u37541@uwewrote in message
news:798bc3f05f9b3@uwe...
When I click "save" after adding a new record (which contains, among other
fields, the person's email address), I want an email to automatically be
sent
to that person (at the email that is in the field of that record). How can
I
do this?

Thanks so much, it really means so much to me!!!
One of the most difficult things to do is help a non-developer tweak ASP
code that has been auto-generated by some tool such as ASPRunner, Frontpage
or Dreamweaver.

We like to be able to get a clear picture of what is going on by reviewing
the code but auto-generated code is very, very difficult to follow.

Unfortunately I think that unless the tool you are using provides a means of
injecting your own code into the page any guess we come up with (and it will
be a guess) will fail or work for awhile and then when you tweak the page
the newly generated code will trash the changes made.

Have you got an email account through which to send these emails?

There is a line in your posted ASP (further down in the first branch of this
thread) that looks like:-

DoEvent "AfterAdd()"

My _guess_ is that its after this line you want to call a function to send
an email.
I recommend that you place the email function in a separate asp file.

--
Anthony Jones - MVP ASP/ASP.NET

Oct 14 '07 #22

P: n/a
Anthony,

Thank you. It turns out I am in fact using ASP, not ASP.NET. So, I call a
function, okay, awesome, but how do I set up my mail smtp server (which will
be gmail) and other info, and do I need to "call" that?

Anthony Jones wrote:
>When I click "save" after adding a new record (which contains, among other
fields, the person's email address), I want an email to automatically be sent
to that person (at the email that is in the field of that record). How can I
do this?

Thanks so much, it really means so much to me!!!

One of the most difficult things to do is help a non-developer tweak ASP
code that has been auto-generated by some tool such as ASPRunner, Frontpage
or Dreamweaver.

We like to be able to get a clear picture of what is going on by reviewing
the code but auto-generated code is very, very difficult to follow.

Unfortunately I think that unless the tool you are using provides a means of
injecting your own code into the page any guess we come up with (and it will
be a guess) will fail or work for awhile and then when you tweak the page
the newly generated code will trash the changes made.

Have you got an email account through which to send these emails?

There is a line in your posted ASP (further down in the first branch of this
thread) that looks like:-

DoEvent "AfterAdd()"

My _guess_ is that its after this line you want to call a function to send
an email.
I recommend that you place the email function in a separate asp file.
--
Message posted via WebmasterKB.com
http://www.webmasterkb.com/Uwe/Forums.aspx/asp/200710/1

Oct 15 '07 #23

P: n/a
"majahops via WebmasterKB.com" <u37541@uwewrote in message
news:79b3bc160c577@uwe...
Anthony,

Thank you. It turns out I am in fact using ASP, not ASP.NET. So, I call a
function, okay, awesome, but how do I set up my mail smtp server (which
will
be gmail) and other info, and do I need to "call" that?
[snip]

You don't need to set up an SMTP server if you are using GoDaddy for
hosting.

Save the script I posted as "Email.asp" and test it as-is.
Oct 15 '07 #24

P: n/a
*** I TRIED YOUR SCRIPT AS IS AND IT WORKED, IT SENT AN EMAIL TO ME, WHEN I
CHANGED THE TO: EMAIL FROM YOURS TO MINE!!! ***

Now all I need to know is how to make it send an email to the email address I
add for a doctor when I add them to the database and click "save".

The name of the email field is "email"... as you can see from the following
little shot of code in the doctors_add.asp page:

insert Email field
strValue=false
if avalues.exists("Email") then _
strValue = avalues.Item("Email")
if not errorhappened and not (vartype(strValue)=11 and strValue=False) then
if isnull(strValue) then strValue=""
ctype = GetRequestForm("type_Email")
rs("Email") = strValue

.... So how do I use the value for "email" to send an email to when I click
on save, the relevant code for which is shown below - from an html file
called Doctors_add.html:

<TD style="BACKGROUND-COLOR: #e6e6fa" align=middle width=414 colSpan=2><INPUT
class=button id=submit1 type=submit value=Save name=submit1>
<INPUT class=button type=reset value=Reset<input type=hidden name="a"
value="added"></TD></TR></FORM>

This is the part about the adding of the record in the original ASP:
'// after add event
DoEvent "AfterAdd()"
message="<div class=message><<< " & "Record was added" & " >>></div>"
end if
else
readavalues=true
end if
... im guess I put the command for it to "call" email.asp based on a record
somewhere here, but have no idea how to?

majahops wrote:
>Awesome. How do I link it to the email address that I created in the record
though? Thanks again!!!
>>Anthony,
[quoted text clipped - 8 lines]
>>
Save the script I posted as "Email.asp" and test it as-is.
--
Message posted via http://www.webmasterkb.com

Oct 15 '07 #25

P: n/a
Awesome. How do I link it to the email address that I created in the record
though? Thanks again!!!

McKirahan wrote:
>Anthony,

Thank you. It turns out I am in fact using ASP, not ASP.NET. So, I call a
function, okay, awesome, but how do I set up my mail smtp server (which will
be gmail) and other info, and do I need to "call" that?

[snip]

You don't need to set up an SMTP server if you are using GoDaddy for
hosting.

Save the script I posted as "Email.asp" and test it as-is.
--
Message posted via http://www.webmasterkb.com

Oct 15 '07 #26

P: n/a
Hey majahops,

Why didn't you say you were using GoDaddy? I've created 3 different email
forms on 3 different sites using GoDaddy.

The text will go before your <htmltag in your web page. Remember to name
it with the ".asp" extension - not a ".htm" or ".html" extension!

The code before the <htmltag will be read by the server, and will not
appear in the Client's browser when he views the source for your page.

I'll be happy to email you an example, if you'd like. Just shoot me an email
using my contact form on my crappy website:
http://www.joeswelding.biz/
It needs a re-design to make it less bandwidth intensive, but I am getting
lots of experience with Classic ASP on parts of it.

"majahops via WebmasterKB.com" wrote:
McKirahan,

Before I do this, where do I put all of this text? That has been one of
the
things that is unclear to me. Do I put it next to the like where the save-
button is in the html, or what? Thanks so much again!

Oct 16 '07 #27

P: n/a
Joe, thanks so much! The only question I have really is how do I call the
specific email that I have in the persons record that I am clicking save for?
Thanks again.

jp2code wrote:
>Hey majahops,

Why didn't you say you were using GoDaddy? I've created 3 different email
forms on 3 different sites using GoDaddy.

The text will go before your <htmltag in your web page. Remember to name
it with the ".asp" extension - not a ".htm" or ".html" extension!

The code before the <htmltag will be read by the server, and will not
appear in the Client's browser when he views the source for your page.

I'll be happy to email you an example, if you'd like. Just shoot me an email
using my contact form on my crappy website:
http://www.joeswelding.biz/
It needs a re-design to make it less bandwidth intensive, but I am getting
lots of experience with Classic ASP on parts of it.
>McKirahan,

Before I do this, where do I put all of this text? That has been one of
the
things that is unclear to me. Do I put it next to the like where the save-
button is in the html, or what? Thanks so much again!
--
Message posted via http://www.webmasterkb.com

Oct 17 '07 #28

P: n/a
... but i put a space between ) and "then" of course

majahops wrote:
>So when I put in the code, I get the following message when I try to save the
record:

Error number 3749
Error description Fields update failed. For further information, examine the
Status property of individual field objects.

...

Here is my code (i renamed the function to "mail")

function mail
If mail(email,"your subject","your message")then
' success
Else
' failure
End If
end function
>>*** I TRIED YOUR SCRIPT AS IS AND IT WORKED, IT SENT AN EMAIL TO ME, WHEN I
CHANGED THE TO: EMAIL FROM YOURS TO MINE!!! ***
[quoted text clipped - 31 lines]
>>You may also want to ensure that the email address is correctly
formatted before sending the email otherwise it will "bounce".
--
Message posted via http://www.webmasterkb.com

Oct 17 '07 #29

P: n/a
Any ideas?

majahops wrote:
>... but i put a space between ) and "then" of course
>>So when I put in the code, I get the following message when I try to save the
record:
[quoted text clipped - 20 lines]
>>>You may also want to ensure that the email address is correctly
formatted before sending the email otherwise it will "bounce".
--
Message posted via http://www.webmasterkb.com

Oct 17 '07 #30

P: n/a
"majahops via WebmasterKB.com" <u37541@uwewrote in message
news:79ced47655496@uwe...
.. but i put a space between ) and "then" of course

majahops wrote:
So when I put in the code, I get the following message when I try to save
the
record:

Error number 3749
Error description Fields update failed. For further information, examine
the
Status property of individual field objects.

...

Here is my code (i renamed the function to "mail")

function mail
If mail(email,"your subject","your message")then
' success
Else
' failure
End If
end function
[snip]

You're calling the function from within itself!

Why did you put the "If" statement inside of a function?

Look another look at what I gave you before.
Oct 17 '07 #31

P: n/a
"McKirahan" <Ne**@McKirahan.comwrote in message
news:ZO******************************@comcast.com. ..
"majahops via WebmasterKB.com" <u37541@uwewrote in message
news:79ced47655496@uwe...
.. but i put a space between ) and "then" of course

majahops wrote:
>So when I put in the code, I get the following message when I try to
save
the
>record:
>
>Error number 3749
>Error description Fields update failed. For further information,
examine
the
>Status property of individual field objects.
>
>...
>
>Here is my code (i renamed the function to "mail")
>
>function mail
>If mail(email,"your subject","your message")then
>' success
>Else
>' failure
>End If
>end function

[snip]

You're calling the function from within itself!

Why did you put the "If" statement inside of a function?

Look another look at what I gave you before.
Take another look at what I gave you before.

Use the function that worked for you before:

Function Email(sAddr,sSubj,sBody)
...
End Function
Oct 17 '07 #32

P: n/a
Oh no, I meant that was the code for CALLING the function.

McKirahan wrote:
.. but i put a space between ) and "then" of course
[quoted text clipped - 26 lines]
>>
Look another look at what I gave you before.

Take another look at what I gave you before.

Use the function that worked for you before:

Function Email(sAddr,sSubj,sBody)
...
End Function
--
Message posted via WebmasterKB.com
http://www.webmasterkb.com/Uwe/Forums.aspx/asp/200710/1

Oct 17 '07 #33

P: n/a
I'm looking at this and I am so lost. Right now I have a file called
Doctors_add.asp, which works well to add a doctors record. The part of this
file with the function in it is below:

Response.Write("send_email = " & send_email("ma******@gemail.com","Test",
"Test!"))

Function send_email(sAddr,sSubj,sBody)
send_email = False
On Error Resume Next
'*
'* Declare Constants
'*
Const cCDO = "http://schemas.microsoft.com/cdo/configuration/"
Const cHST = "relay-hosting.secureserver.net"
Const cFRM = "tb***@mednet.ucla.edu"
'*
'* Send email
'*
Dim objCFG
Set objCFG = Server.CreateObject("CDO.Configuration")
objCFG.Fields.Item(cCDO & "sendusing") = 2
objCFG.Fields.Item(cCDO & "smtpserver") = cHST
objCFG.Fields.Item(cCDO & "smtpserverport") = 25
objCFG.Fields.Update
Dim objCDO
Set objCDO = Server.CreateObject("CDO.Message")
objCDO.From = cFRM
objCDO.To = sAddr
'objCDO.BCC = ""
'objCDO.CC = ""
objCDO.Subject = sSubj
objCDO.TextBody = sBody
'objCDO.HTMLBody = sBody
'objCDO.AddAttachment = ""
objCDO.Configuration = objCFG
objCDO.Send
' If Err = 0 Then
' Response.Write("<br><br><b>E-email has been sent.</b>")
' Else
' Response.Write("<br><b>Sub send_email()</b>")
' Response.Write("<br><b>CDO Failed:</b" & Err.Description)
' Response.Write("<br><b>CDO 'Addr':</b" & sAddr)
' Response.Write("<br><b>CDO 'Subj':</b" & sSubj)
' Response.Write("<br><b>CDO 'Body':</b" & sBody)
' End If
Set objCDO = Nothing
Set objCFG = Nothing
'*
'* Return
'*
On Error GoTo 0
send_email = True
End Function

... but no email is sent when I click save. Any idea?

--
Message posted via http://www.webmasterkb.com

Oct 17 '07 #34

P: n/a
"majahops via WebmasterKB.com" <u37541@uwewrote in message
news:79d5bea87d8b4@uwe...
I'm looking at this and I am so lost. Right now I have a file called
Doctors_add.asp, which works well to add a doctors record. The part of
this
file with the function in it is below:

Response.Write("send_email = " & send_email("ma******@gemail.com","Test",
"Test!"))
What does the above line return?

Is it "send_mail = True" or send_mail = False"?

Remove the single quotes from theses lines and see what you get.

' If Err = 0 Then
' Response.Write("<br><br><b>E-email has been sent.</b>")
' Else
' Response.Write("<br><b>Sub send_email()</b>")
' Response.Write("<br><b>CDO Failed:</b" & Err.Description)
' Response.Write("<br><b>CDO 'Addr':</b" & sAddr)
' Response.Write("<br><b>CDO 'Subj':</b" & sSubj)
' Response.Write("<br><b>CDO 'Body':</b" & sBody)
' End If

Oct 17 '07 #35

This discussion thread is closed

Replies have been disabled for this discussion.