navigation
a webmaster learning community
     Home    Register     Search      Help      Login    
Sponsors

Shopping Cart Software
Ecommerce software integrated into Frontpage, Dreamweaver and Golive templates. No monthly fees and available in ASP and PHP versions.

Website Templates
We also have a wide selection of Dreamweaver, Expression Web and Frontpage templates as well as webmaster tools and CSS layouts.

Frontpage website templates
Creative Website Templates for FrontPage, Dreamweaver, Flash, SwishMax

Search Forums
 

Advanced search
Recent Posts

 Todays Posts
 Most Active posts
 Posts since last visit
 My Recent Posts
 Mark posts read

Microsoft MVP

 

Adding User to CDOSYS Email Notification

 
View related threads: (in this forum | in all forums)

Logged in as: Guest
Users viewing this topic: none
Printable Version 

All Forums >> Web Development >> ASP and Database >> Adding User to CDOSYS Email Notification
Page: [1] 2   next >   >>
 
evanesnard

 

Posts: 225
Joined: 4/10/2006
Status: offline

 
Adding User to CDOSYS Email Notification - 5/24/2006 18:39:29   
I could really use some help in tweaking some CDOSYS email code that I’m currently using.

I’m currently sending myself an email notice when a User sets up a New Ad. This is a completely separate incident from when a User sets up a New Account in Spooky Login so unfortunately I am unable to utilize SL’s excellent email notification system for when my Users set up New Ads.

Therefore, I have embedded the following code directly in my Ad_Setup_Confirmation.asp page so whenever a User sets up a New Ad, I receive an email notification. This is working great in terms of notifying me.

Now, what I’d like to do is notify the User when they setup a New Ad and also include some specific Ad-related info in the email notification.

How can I modify the following code to achieve these two things?

1) Notify the actual User who just setup the New Ad (User’s DB email column is Contact_Email)

2) Include some Ad-specific info in the body of the email; just for the sake of it we’ll say UserID and Ad_ID which are two of my DB columns pertaining to new ads.

I’m assuming I could put two separate CDOSYS scripts in this same page in order to be able to customize one with info for the Admin Notification and the other customized with info for the User Notification. Is this a valid assumption?

Thanks in advance for your help.

The code I’m currently using to send the email notification to myself is:

<%
strText = "Hello Admin, This email is to notify you that a New Ad just signed up."
Const cdoSendUsingPort = 2
Const strSmartHost = "localhost"

Set myMail = CreateObject("CDO.Message")
Set iConf = myMail.Configuration

With iConf.Fields
.item("http://schemas.microsoft.com/cdo/configuration/sendusing") = cdoSendUsingPort
.item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = strSmartHost
.Update
End With

With iConf.Fields
.item("http://schemas.microsoft.com/cdo/configuration/sendusing") = cdoSendUsingPort
.item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = strSmartHost
.Update
End With

With myMail
myMail.From = "me@mydomain.com" (I’m using my actual email address)
myMail.To = "me@mydomain.com" (I’m using my actual email address)
myMail.Subject = "New Ad"
myMail.HTMLBody = strText
myMail.Send
End With

Set myMail = Nothing
%>
rdouglass

 

Posts: 9224
From: Biddeford, ME USA
Status: offline

 
RE: Adding User to CDOSYS Email Notification - 5/24/2006 20:09:37   
How about turning it into a function? I generally will turn a CDOSYS script into a function and pass parameters to it whenever I want to send an email from wherever.

Put a function similar to this in an include page or at the beginning of any page you want to use it on:

FUNCTION sendEmail(myMailTo,myMailFrom,myMailSubject,myMailBody)

	Const cdoSendUsingPort = 2
	Const strSmartHost = "localhost" 'serverEmailHost

	Set myMail = CreateObject("CDO.Message")
	Set iConf = myMail.Configuration
	
	With iConf.Fields
		.item("http://schemas.microsoft.com/cdo/configuration/sendusing") = cdoSendUsingPort
		.item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = strSmartHost
		.Update
	End With

	With myMail
		myMail.From = myMailFrom
		myMail.To = myMailTo
		myMail.Subject = myMailSubject
		myMail.HTMLBody = myMailBody
		myMail.Send
	End With
	
	Set myMail = Nothing 
END FUNCTION


Then you can call the function any time you need it like this:

<% call sendEmail("newuser@domain.com","me@myDomain.com","New User Subject","new User Body")

call sendEmail("me@myDomain.com","me@myDomain.com","A New User Signed Up","new User Details")%>

And those values that are being passed can be eseentially any variable, text values, request.forms, etc.

Does that help at all?

_____________________________

Don't take you're eye off your final destination.

ASP Checkbox Function Tutorial.

(in reply to evanesnard)
evanesnard

 

Posts: 225
Joined: 4/10/2006
Status: offline

 
RE: Adding User to CDOSYS Email Notification - 5/24/2006 21:19:55   
That might be an option to explore. I was really hoping to stay with the CDOSYS code I'm currently using since I already embedded it in quite a few pages.

I was wanting to hopefully just have to add some additional code into my existing CDOSYS code to reflect the changes I mentioned above.

Can you help me approach it from that angle?

(in reply to rdouglass)
rdouglass

 

Posts: 9224
From: Biddeford, ME USA
Status: offline

 
RE: Adding User to CDOSYS Email Notification - 5/24/2006 21:33:40   
I was really hoping to stay with the CDOSYS code I'm currently using


It really is so close to what you're using that it's almost negligable. I've just wrapped it inside a FUNCTION and END FUNCTION lines and I made all the To,From, Subject, and Body into variables. I really am showing you an easier way but there's just a tiny little speed bump.

quote:

1) Notify the actual User who just setup the New Ad (User’s DB email column is Contact_Email)


Well to start with, if you're going to be using the address in the DB, you'll have to have a database routine in there somewhere.

Can you get that value without an additional database script? Could you request.form it or some other way? Will this script run on the same page as a database entry / insert / update?

_____________________________

Don't take you're eye off your final destination.

ASP Checkbox Function Tutorial.

(in reply to evanesnard)
evanesnard

 

Posts: 225
Joined: 4/10/2006
Status: offline

 
RE: Adding User to CDOSYS Email Notification - 5/24/2006 21:50:13   
Almost all of the pages, except one I believe, are confirmation pages with a DRW built into them. They work like this for example. Ad_Cancel.asp has a DRW and then passes to Ad_Cancel_Confirmation.asp which also has a DRW and has a custom SQL statement in FP DRW and when Ad_Cancel_Confirmation.asp is submitted, it writes the update to that particular DB record.

The one confirmation page that does not have a DRW on it displays the email by the following:

<!--webbot bot="ConfirmationField" s-field="Contact_Email" -->

(in reply to rdouglass)
rdouglass

 

Posts: 9224
From: Biddeford, ME USA
Status: offline

 
RE: Adding User to CDOSYS Email Notification - 5/24/2006 23:12:07   
I'm kinda' thinking it may be easier to set a session somewhere in there for the user's email and grab it in the script.

For instance, somewhere in one of those DRW's you set the session("useremail") you can grab it directly in your CDOSYS script when needed:

myMail.To = session("useremail")

Maybe? If you can solve that email dilema, the rest of those parameters (body, subject, etc.) should be pretty straightforward.

_____________________________

Don't take you're eye off your final destination.

ASP Checkbox Function Tutorial.

(in reply to evanesnard)
evanesnard

 

Posts: 225
Joined: 4/10/2006
Status: offline

 
RE: Adding User to CDOSYS Email Notification - 5/24/2006 23:24:49   
That sounds pretty interesting and great idea to try.

How would I go about setting a session for Contact_Email in the DRW?

For instance, on my Ad_Cancel_Confirmation.asp, the DRW looks like this:

</SCRIPT>
<% end if %>
<%
fp_sQry="UPDATE Ads SET Action_Last = ::Action_Last::, Action_Last_Date = ::Action_Last_Date::, Action_Last_UserID = ::Action_Last_UserID::, Action_History = ::Action_History::, Action_History_Date = ::Action_History_Date::, Action_History_UserID = ::Action_History_UserID::, Disposition = ::Disposition::, Ad_Status = '::Ad_Status::' WHERE Ad_ID = ::Ad_ID::"
fp_sDefault="Action_Last=&Action_Last_Date=&Action_Last_UserID=&Action_History=&Action_History_Date=&Action_History_UserID=&Disposition=&Ad_Status=&Ad_ID="
fp_sNoRecords=""
fp_sDataConn="Signup"
fp_iMaxRecords=256
fp_iCommandType=1
fp_iPageSize=0
fp_fTableFormat=False
fp_fMenuFormat=False
fp_sMenuChoice=""
fp_sMenuValue=""
fp_sColTypes="&Timestamp=135&Browser_type=202&User_name=202&Remote_computer_name=202&Terms_Of_Use=202&Contact_Time=202&Contact_Website=202&Contact_IM=202&Contact_Email=202&Contact_Pager_PIN=202&Contact_Pager=202&Contact_Phone_2=202&Contact_Phone_1=202&Contact_Zip_Code=202&Contact_City=202&Contact_State=202&Contact_Country=202&Contact_Last_Name=202&Contact_First_Name=202&Payment_Accepted_Comments=202&Payment_Accepted=202&Payment_Terms=202&Rates=202&Service_References=202&Service_Degrees_Certifications=202&Service_Qualifications=202&Service_Area=202&Service_Details=202&Service_Type=202&Business_Zip_Code=202&Business_City=202&Business_State=202&Business_Country=202&Business_Address=202&Business_Hours=202&Company_Formed=202&Individual_Name=202&Company_Name=202&Business_or_Individual=202&Ad_Category_Details=202&Ad_Category=202&Ad_City=202&Ad_State=202&Ad_Country=202&Ad_ID=3&Ad_Status=202&Disposition=202&Action_History_UserID=203&Action_History_Date=203&Action_History=203&Action_Last_UserID=202&Action_Last_Date=135&Action_Last=202&Advertiser_ID=202&x_Email=202&x_City=202&x_Country=202&x_Lastname=202&x_Firstname=202&Password=202&UserName=202&UserID=3&"
fp_iDisplayCols=16
fp_fCustomQuery=True
BOTID=0
fp_iRegion=BOTID
%>
<!--#include file="_fpclass/fpdbrgn1.inc"-->



Are you saying that the set session Contact_Email should go somewhere in that DRW and if so, where would it go and how would the set session be coded?

I'm trying to hang with you on this but not sure I follow.

< Message edited by Spooky -- 5/25/2006 1:29:53 >

(in reply to rdouglass)
Spooky

 

Posts: 26599
Joined: 11/11/1998
From: Middle Earth
Status: offline

 
RE: Adding User to CDOSYS Email Notification - 5/25/2006 1:34:44   
Is "Contact_Email" the same as "x_email" in the users table?
If not - where in the current process would you load the values from that seperate table?

_____________________________

If you arent part of the solution, then there is good money to be made prolonging the problem

§ţ:)


(in reply to evanesnard)
evanesnard

 

Posts: 225
Joined: 4/10/2006
Status: offline

 
RE: Adding User to CDOSYS Email Notification - 5/25/2006 9:33:09   
They are actually two different emails stored in two different tables in the same DB.

However, I'm glad you asked that question because I just realized that I want to notify x_email and not Contact_Email.

The way I have things setup, x_email is, as the default is in SL, the email associated with the User's Account. Contact_Email is an email column I have setup that a User can use to designate an email address for potential customers to contact them regarding the User's advertised services in that specific Ad. Hope I didn't convolute that explanation too much.

So, long story short, User Cancels an Ad and both me and the User themselves need to be notified (even though the User cancelled the Ad themselves, the email notification is sort of for their records that they cancelled).

The page I'm running the CDOSYS code on, Ad_Cancel_Confirmation.asp has a DRW on it which has queried the Ad table which holds Contact_Email. However, I've since realized that's not the email address I need to notify.

I need to notify x_Email.

I have inserted <%=Session("x_Email")%> into Ad_Cancel_Confirmation.asp to see if it would grab it from the session and it did display the x_Email email address for the User Account associated with that specific Ad Cancellation.

So if we're sitting at the Ad_Cancel_Confirmation.asp page which has my CDOSYS code embedded in it, it's notifying me correctly at this point, and now I need to add notification to x_Email into that same CDOSYS code, and x_Email seems to be obtainable from the session.

How would you recommend that I carry that out?

You can see the CDOSYS code I'm running further up in this thread.

Thanks in advance for your help on this.

< Message edited by evanesnard -- 5/25/2006 10:03:23 >

(in reply to Spooky)
Spooky

 

Posts: 26599
Joined: 11/11/1998
From: Middle Earth
Status: offline

 
RE: Adding User to CDOSYS Email Notification - 5/25/2006 16:11:28   
Like so - add a check to see if the session is populated :

If Session("x_Email") &""<>"" then


.... your mail code
.....
myMail.To = Session("x_Email")
.....


ENd if


_____________________________

If you arent part of the solution, then there is good money to be made prolonging the problem

§ţ:)


(in reply to evanesnard)
evanesnard

 

Posts: 225
Joined: 4/10/2006
Status: offline

 
RE: Adding User to CDOSYS Email Notification - 5/25/2006 19:04:32   
Thanks Spooky. That works great.

How can I include the UserID and Ad_ID in the body of the email to provide the User a record of the specific Ad they just cancelled?

Those two values are also obtainable from the session.

I tried putting UserID and Ad_ID in the strText = ... but it didn't like that. The page errored on submission and the submission failed.

My strText currently looks like this:

strText = "Hello, This email is to provide you with a record of the Ad you just Cancelled."

Thanks.

(in reply to Spooky)
rdouglass

 

Posts: 9224
From: Biddeford, ME USA
Status: offline

 
RE: Adding User to CDOSYS Email Notification - 5/26/2006 8:56:13   
quote:

Those two values are also obtainable from the session.


If they are, then your strText ould look something like this:

strText = "Hello, This email is to provide you with a record of the Ad you just Cancelled. The UserID is: " & session("UserID") & " and your Ad ID is: " & session("Ad_ID")

This is assuming the sessions are named that appropriately.

Sessions are very useable but they are not an 'end-all' solution. If you're requiring a lot of record information in the email, why don't you just do another db call and grab the info that way? Then you'd only have to pass a record ID or such smaller bit of info. I know it will probably take a little learning curve to do it but I suspect you'll be glad you did.

I usually am.

_____________________________

Don't take you're eye off your final destination.

ASP Checkbox Function Tutorial.

(in reply to evanesnard)
evanesnard

 

Posts: 225
Joined: 4/10/2006
Status: offline

 
RE: Adding User to CDOSYS Email Notification - 5/26/2006 9:25:00   
Good morning. Thanks for your reply back.

I've setup my CDOSYS code as a FUNCTION as you previously suggested at it's working great. Thank you!

The only thing I'm trying to tweak now is the email body so I appreciate the previous info you just sent. I just tried that and it's working nicely too.

How can I make the email body look a bit more formatted and not so much in one straight sentence.

What I would like is something like this in the email body:

This email confirms that you have cancelled the following Ad. You do not need to reply back to this email.

Ad ID: Session(“Ad_ID”)
Ad Category: Session(“Ad_Category”)
Ad City: Session(“Ad_City”)
Ad Country: Session(“Ad_Country”)

User ID: Session(“UserID”)
First Name: Session(“x_Firstname”)
Last Name: Session(“x_Lastname”)
Email: Session(“x_Email”)

Please note that you can easily Renew any of your Cancelled Ads at any time by logging into your Account Management Center and clicking on the "Renew" link next to the corresponding Cancelled Ad that you would like to Renew.

Thank you very much for advertising with us. We hope you found our services to be very helpful and beneficial in the advertising of your services. We sincerely hope to have the opportunity to be a part of your future advertising strategy and wish you great success in your endeavors.


Sincerely,
The Team

(in reply to rdouglass)
rdouglass

 

Posts: 9224
From: Biddeford, ME USA
Status: offline

 
RE: Adding User to CDOSYS Email Notification - 5/26/2006 9:38:07   
You *can* send HTML formatted messages with CDOSYS:

<%DIM strText

strText = ""
strText = strText & "<html>" & VbCrLf
strText = strText & "<body>" & VbCrLf
strText = strText & "<table>" & VbCrLf

.....

Then pass strText to the function just like you're doing now. See, what I do is basically build an html page and pass it as the body of the message.

That make any sense at all or did I not give enough of an example?

_____________________________

Don't take you're eye off your final destination.

ASP Checkbox Function Tutorial.

(in reply to evanesnard)
evanesnard

 

Posts: 225
Joined: 4/10/2006
Status: offline

 
RE: Adding User to CDOSYS Email Notification - 5/26/2006 9:49:27   
You lost me now on a couple of things.

1) We removed strText all together out of the CDOSYS script when we made it into a FUNCTION.

2) I don't understand how the html page would have the session values in it.

I'm currently using this:

<% call sendEmail("newuser@domain.com","me@myDomain.com","New User Subject","new User Body")

call sendEmail("me@myDomain.com","me@myDomain.com","A New User Signed Up","new User Details")%>

FUNCTION sendEmail(myMailTo,myMailFrom,myMailSubject,myMailBody)

Const cdoSendUsingPort = 2
Const strSmartHost = "localhost" 'serverEmailHost

Set myMail = CreateObject("CDO.Message")
Set iConf = myMail.Configuration

With iConf.Fields
.item("http://schemas.microsoft.com/cdo/configuration/sendusing") = cdoSendUsingPort
.item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = strSmartHost
.Update
End With

With myMail
myMail.From = myMailFrom
myMail.To = myMailTo
myMail.Subject = myMailSubject
myMail.HTMLBody = myMailBody
myMail.Send
End With

Set myMail = Nothing
END FUNCTION

(in reply to rdouglass)
rdouglass

 

Posts: 9224
From: Biddeford, ME USA
Status: offline

 
RE: Adding User to CDOSYS Email Notification - 5/26/2006 10:12:58   
quote:

<%DIM strText

strText = ""
strText = strText & "<html>" & VbCrLf
strText = strText & "<body>" & VbCrLf
strText = strText & "<table>" & VbCrLf

.....


Let me fill this in a bit for you:

<%DIM strText

strText = ""
strText = strText & "<html>" & VbCrLf
strText = strText & "<body>" & VbCrLf
strText = strText & "<table>" & VbCrLf
strText = strText & "<tr><td>" & VbCrLf
strText = strText & "Ad ID: " & Session(“Ad_ID”) & "<br>"
strText = strText & "Ad Category: " & Session(“Ad_Category”) & "<br>"
strText = strText & "Ad City: " & Session(“Ad_City”) & "<br>"
strText = strText & "Ad Country: " & Session(“Ad_Country”) & "<br>"
strText = strText & "</td></tr></table>" & VbCrLf
strText = strText & "</body></html>" & VbCrLf

call sendEmail ("me@myDomain.com","me@myDomain.com","A New User Signed Up",strText)%>

That help at all? Can you see what I'm doing? Just like writing to the browser except we're putting it all into a variable and passing that variable to the function as our body.

_____________________________

Don't take you're eye off your final destination.

ASP Checkbox Function Tutorial.

(in reply to evanesnard)
evanesnard

 

Posts: 225
Joined: 4/10/2006
Status: offline

 
RE: Adding User to CDOSYS Email Notification - 5/26/2006 10:52:21   
That does help. I see what you're doing but I've obviously broken something in the process of integrating that last piece of code.

Can you take a look at this and tell me what I'm doing wrong? Thanks.

<%DIM strText

strText = ""
strText = strText & "<html>" & VbCrLf
strText = strText & "<body>" & VbCrLf
strText = strText & "<table>" & VbCrLf
strText = strText & "<tr><td>" & VbCrLf
strText = strText & "Ad City: " & Session(“Ad_City”) & "<br>"
strText = strText & "Ad Country: " & Session(“Ad_Country”) & "<br>"
strText = strText & "</td></tr></table>" & VbCrLf
strText = strText & "</body></html>" & VbCrLf

call sendEmail("me@myDomain.com","me@myDomain.com","Cancelled Ad",strText)%>

<%
FUNCTION sendEmail(myMailFrom,myMailTo,myMailSubject,strText)
Const cdoSendUsingPort = 2
Const strSmartHost = "localhost"

Set myMail = CreateObject("CDO.Message")
Set iConf = myMail.Configuration

With iConf.Fields
.item("http://schemas.microsoft.com/cdo/configuration/sendusing") = cdoSendUsingPort
.item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = strSmartHost
.Update
End With

With iConf.Fields
.item("http://schemas.microsoft.com/cdo/configuration/sendusing") = cdoSendUsingPort
.item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = strSmartHost
.Update
End With

With myMail
myMail.From = myMailFrom
myMail.To = myMailTo
myMail.Subject = myMailSubject
myMail.HTMLBody = strText
myMail.Send
End With


Set myMail = Nothing
END FUNCTION
%>

(in reply to rdouglass)
rdouglass

 

Posts: 9224
From: Biddeford, ME USA
Status: offline

 
RE: Adding User to CDOSYS Email Notification - 5/26/2006 10:55:59   
quote:

Session(“Ad_City”)


If it 'broke', can you be more descriptive like any error messages or what it does or doesn't do? It's hard to tell if I don't know what's happening.

One thing that does look funny is the "curly" quotes in the session variables. Try typing them in there instead of using what pasted.

Also, as a rule of thumb, I always paste into Notepad first befor epasting into FP to clear out any funny formatting, etc.

_____________________________

Don't take you're eye off your final destination.

ASP Checkbox Function Tutorial.

(in reply to evanesnard)
evanesnard

 

Posts: 225
Joined: 4/10/2006
Status: offline

 
RE: Adding User to CDOSYS Email Notification - 5/26/2006 11:11:21   
Good eye on catching the "curly" quotes. Sure enough, that was the problem. I should have caught that and I usually paste into Notepad as well but in my haste on implementing that last piece of code, I failed to do so. Errr.

Thanks for helping me catch that. It's working good now.

Now, I need to add in my other call sendEmail("user@userdomain.com","user@userdomain.com","Cancelled Ad",strText)%>

but how will I designate a whole different set of strText so the Users message body contains different custom info than what I'm receiving?

(in reply to rdouglass)
rdouglass

 

Posts: 9224
From: Biddeford, ME USA
Status: offline

 
RE: Adding User to CDOSYS Email Notification - 5/26/2006 11:21:23   
quote:

designate a whole different set of strText


How about strText2 as a second variable?

_____________________________

Don't take you're eye off your final destination.

ASP Checkbox Function Tutorial.

(in reply to evanesnard)
evanesnard

 

Posts: 225
Joined: 4/10/2006
Status: offline

 
RE: Adding User to CDOSYS Email Notification - 5/26/2006 11:48:53   
Makes perfect sense. Given that, I've got a few questions on exactly how to do that.

How would I work strText2 into here?

<%DIM strText

strText = ""
strText = strText & "<html>" & VbCrLf
strText = strText & "<body>" & VbCrLf
strText = strText & "<table>" & VbCrLf
strText = strText & "<tr><td>" & VbCrLf
strText = strText & "Test" & "<br>"
strText = strText & "Ad City: " & Session("Ad_City") & "<br>"
strText = strText & "Ad Country: " & Session("Ad_Country") & "<br>"
strText = strText & "</td></tr></table>" & VbCrLf
strText = strText & "</body></html>" & VbCrLf

Would I create a whole other DIM strText group and add it in with the first DIMstrText like so?

<%DIM strText

strText = ""
strText = strText & "<html>" & VbCrLf
strText = strText & "<body>" & VbCrLf
strText = strText & "<table>" & VbCrLf
strText = strText & "<tr><td>" & VbCrLf
strText = strText & "Test" & "<br>"
strText = strText & "Ad City: " & Session("Ad_City") & "<br>"
strText = strText & "Ad Country: " & Session("Ad_Country") & "<br>"
strText = strText & "</td></tr></table>" & VbCrLf
strText = strText & "</body></html>" & VbCrLf

DIM strText2

strText2 = ""
strText2 = strText2 & "<html>" & VbCrLf
strText2 = strText2 & "<body>" & VbCrLf
strText2 = strText2 & "<table>" & VbCrLf
strText2 = strText2 & "<tr><td>" & VbCrLf
strText2 = strText2 & "Test" & "<br>"
strText 2= strText2 & "Ad City: " & Session("Ad_City") & "<br>"
strText2 = strText2 & "Ad Country: " & Session("Ad_Country") & "<br>"
strText2 = strText2 & "</td></tr></table>" & VbCrLf
strText2 = strText2 & "</body></html>" & VbCrLf


call sendEmail("mydomain.com","mydomain.com","Cancelled Ad",strText)

call sendEmail("user@userdomain.com","user@userdomain.com","Cancelled Ad",strText2)%>


and how do I work strText2 into this group of code?

With myMail
myMail.From = myMailFrom
myMail.To = myMailTo
myMail.Subject = myMailSubject
myMail.HTMLBody = strText
myMail.Send

(in reply to rdouglass)
rdouglass

 

Posts: 9224
From: Biddeford, ME USA
Status: offline

 
RE: Adding User to CDOSYS Email Notification - 5/26/2006 12:12:59   
quote:

and how do I work strText2 into this group of code


You did it right here:

call sendEmail("user@userdomain.com","user@userdomain.com","Cancelled Ad",strText2)

That is the *whole* purpose of using a function; so you don't have to re-code the CDOSYS routine every time.

And is strText2 different than strText? It doesn't look that way to me.

See the whole idea of using a function is to have code that you can pass items to and do the same thing to those items. Wheat we did is build a function that would send an email. The function is expecting 4 items: who do i send it to, who is it from, what is the subject, and what is the message.

When we call the function like so:

call sendEmail("mydomain.com","mydomain.com","Cancelled Ad",strText)

whatever is in strText will be sent as the body of the message. To change that, change what we're sending in the last item of the function:

call sendEmail("mydomain.com","mydomain.com","Cancelled Ad",strText2)

We do not want to change anything in the function itself but what we are sending to the function.

Does that help?

_____________________________

Don't take you're eye off your final destination.

ASP Checkbox Function Tutorial.

(in reply to evanesnard)
evanesnard

 

Posts: 225
Joined: 4/10/2006
Status: offline

 
RE: Adding User to CDOSYS Email Notification - 5/26/2006 12:34:27   
Very nice! I like this. Thank you very much and I appreciate your patience and guidance in helping me work through this.

Now that it's functioning correctly, I'll go in and actually tweak the contents of each message body individually.

Got another question for you. I noticed a particular problem in working on this CDOSYS email issue as well as when I was working on something different in the past and I'm hoping you can shed some light on this.

The problem: I've noticed that whenever I try to grab a session value for a DB column that happens to be an "AutoNumber" column in the table, the value won't display even though it is being carried by the session.

Do you know why that is and what the cure for that may be. I have to leave that column as an AutoNumber column.

The example is my Ad_ID column that I'm trying to display in these CDOSYS emails. Other column values are displaying just fine in the emails now but Ad_ID, which happens to be an AutoNumber column, will not display and like I said, I've noticed that problem before on several unrelated issues.

Thanks.

(in reply to rdouglass)
rdouglass

 

Posts: 9224
From: Biddeford, ME USA
Status: offline

 
RE: Adding User to CDOSYS Email Notification - 5/26/2006 13:25:40   
quote:

even though it is being carried by the session.


And you know this how? Have you response.write it as in:

<%=session("Ad_id")%>

and that writes the id to the browser? If that does, there may be a typo or something somewhere. If there is a value in that session andyou can write it, there should be no reason that won't work in the body of your message.

Double and triple check all variable names for typos and such.

_____________________________

Don't take you're eye off your final destination.

ASP Checkbox Function Tutorial.

(in reply to evanesnard)
evanesnard

 

Posts: 225
Joined: 4/10/2006
Status: offline

 
RE: Adding User to CDOSYS Email Notification - 5/26/2006 13:32:35   
Correction, what I meant to say was that for some reason, Ad_ID which is an AutoNumber column, is not being carried by the session.

I <%=session("Ad_id")%> and I get nothing.

(in reply to rdouglass)
rdouglass

 

Posts: 9224
From: Biddeford, ME USA
Status: offline

 
RE: Adding User to CDOSYS Email Notification - 5/26/2006 13:42:29   
Where are you trying to assign session("Ad_ID") a value? Can you post the code you're using to write that? Not grabbing *from* the session but where you're writing it *to* the session...

_____________________________

Don't take you're eye off your final destination.

ASP Checkbox Function Tutorial.

(in reply to evanesnard)
evanesnard

 

Posts: 225
Joined: 4/10/2006
Status: offline

 
RE: Adding User to CDOSYS Email Notification - 5/26/2006 13:53:47   
The User logs into Spooky Login and they are directed to a page where a DRW is automatically ran which displays that specific User's Ads. Next to each one of the User's ads is a "Cancel" link which has a paramenter in it. The Cancel links looks like this:

<a href="Ad_Cancel.asp?Ad_ID=<%=FP_FieldURL(fp_rs,"Ad_ID")%>">

The user clicks on that link and it takes them to Ad_Cancel.asp and Ad_Cancel.asp has a DRW which looks like:

<%
fp_sQry="SELECT * FROM Ads WHERE (Ad_ID =  ::Ad_ID::)"
fp_sDefault="Ad_ID="
fp_sNoRecords="No records returned."
fp_sDataConn="Signup"
fp_iMaxRecords=256
fp_iCommandType=1
fp_iPageSize=0
fp_fTableFormat=False
fp_fMenuFormat=False
fp_sMenuChoice=""
fp_sMenuValue=""
fp_sColTypes="&UserID=3&UserName=202&Password=202&x_Firstname=202&x_Lastname=202&x_Country=202&x_City=202&x_Email=202&Advertiser_ID=202&Action_Last=202&Action_Last_Date=135&Action_Last_UserID=202&Action_History=203&Action_History_Date=203&Action_History_UserID=203&Disposition=202&Ad_Status=202&Ad_ID=3&Ad_Country=202&Ad_State=202&Ad_City=202&Ad_Category=202&Ad_Category_Details=202&Business_or_Individual=202&Company_Name=202&Individual_Name=202&Company_Formed=202&Business_Hours=202&Business_Address=202&Business_Country=202&Business_State=202&Business_City=202&Business_Zip_Code=202&Service_Type=202&Service_Details=202&Service_Area=202&Service_Qualifications=202&Service_Degrees_Certifications=202&Service_References=202&Rates=202&Payment_Terms=202&Payment_Accepted=202&Payment_Accepted_Comments=202&Contact_First_Name=202&Contact_Last_Name=202&Contact_Country=202&Contact_State=202&Contact_City=202&Contact_Zip_Code=202&Contact_Phone_1=202&Contact_Phone_2=202&Contact_Pager=202&Contact_Pager_PIN=202&Contact_Email=202&Contact_IM=202&Contact_Website=202&Contact_Time=202&Terms_Of_Use=202&Remote_computer_name=202&User_name=202&Browser_type=202&Timestamp=135&"
fp_iDisplayCols=9
fp_fCustomQuery=False
BOTID=0
fp_iRegion=BOTID
%>

Ad_Cancel.asp then goes to Ad_Cancel_Confirmation.asp which posts the actual "Cancel" update to the DB for that specific Ad_ID.

< Message edited by rdouglass -- 5/26/2006 14:10:51 >

(in reply to rdouglass)
rdouglass

 

Posts: 9224
From: Biddeford, ME USA
Status: offline

 
RE: Adding User to CDOSYS Email Notification - 5/26/2006 14:10:13   
quote:

Ad_Cancel.asp then goes to Ad_Cancel_Confirmation.asp


Wherever you're doing the cancelling should be the place you write the session for the Ad_ID.

...that's assuming that is done before the email is sent but it needs to be done (IMO anyways) just before you actually delete the record.

_____________________________

Don't take you're eye off your final destination.

ASP Checkbox Function Tutorial.

(in reply to evanesnard)
evanesnard

 

Posts: 225
Joined: 4/10/2006
Status: offline

 
RE: Adding User to CDOSYS Email Notification - 5/26/2006 14:17:37   
This may very well be a question regarding Spooky Login.

A session is being created as soon as the User logs into Spooky login. Then immediately at login, the User is automatically directed to Account_Management.asp where that whole process begins as mentioned in the previous message. So as the user is at their Account Management Center viewing their Ads at Account_Management.asp, they click cancel and that whole process begins. Then the record is updated to Cancelled instead of Active, but the record still exists.

< Message edited by evanesnard -- 5/26/2006 14:25:03 >

(in reply to rdouglass)
rdouglass

 

Posts: 9224
From: Biddeford, ME USA
Status: offline

 
RE: Adding User to CDOSYS Email Notification - 5/26/2006 14:33:42   
quote:

Then the record is updated to Cancelled instead of Active, but the record still exists


OK and that is fine, but either way you have an Ad_ID at that point correct? Else how would you update that record to Cancelled?

What I'm saying is that right there is where you should be setting the session.

_____________________________

Don't take you're eye off your final destination.

ASP Checkbox Function Tutorial.

(in reply to evanesnard)
Page:   [1] 2   next >   >>

All Forums >> Web Development >> ASP and Database >> Adding User to CDOSYS Email Notification
Page: [1] 2   next >   >>
Jump to: 1





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts