CodeCharge Studio
search Register Login  

Visual PHP Web Development

Visually Create Internationalized Web Applications, Web Reports, Calendars, and more.
CodeCharge.com

YesSoftware Forums -> CodeCharge Studio -> ASP

 Adding hyperlink to email

Print topic Send  topic

Author Message
webdev

Posts: 19
Posted: 08/12/2006, 7:37 AM

The following code snippet works fine, with one exception. I would like the person to be able to click on a hyperlink.

Mail.AddAddress CCDLookup("email", "users", "user_id=" &_
DBInternet.ToSQL(ccGetUserID, ccsInteger),DBInternet)
Mail.Subject = "Any old subject here"

Mail.isHTML=true
Mail.Body = "There was a link updated by:<br><br>" &_
"User login id = " &_
ccdLookup("user_id","users", "user_id=" &_
DBInternet.ToSQL(ccGetUserID, ccsInteger),DBInternet) &_
"<br><br>link name = " & ccdLookup("links.link_url","links", "user_id_add_by=" &_
DBInternet.ToSQL("user_id_add_by", ccsInteger),DBInternet) &_

"<br><br>Description reads<br>" & links.link_desc.Value

Currently the output looks like this:

There was a link updated by:

User login id = 3

link name = http://www.somewhere.com/

Description reads
Members can now add/edit and delete their own link entries that they put online.

----------------------------------
Probably a simple problems.

Any ideas?

Thanks for any feedback.
View profile  Send private message
webdev

Posts: 19
Posted: 08/13/2006, 12:45 AM

Update:

Thought all was well but it turns out the email references the first row in the links table all the time (in every email generated).

One would assume that since a record was being looked at and modified, the information would appear on that form would be utilized for the email.

Any ideas as to why the first record of the table is being used always?
View profile  Send private message
Waspman

Posts: 948
Posted: 08/13/2006, 3:13 AM

Hi Strnad,

I can't say why you script doesn't work, it's difficult not knowing how you got to the page.

If I do this I gather the info before I run the mail script, that way I can test that the right info is being used.

Then simply build the email script and call all the relevant elements.

I often use straight HTML as the body element and call the link into it that way.

Sorry I can't be more specific, like I said there's always more than one way and I suspect we all do it differently.

If you need any specifics let me know and I'll put up some code.


Tony
_________________
http://www.waspmedia.co.uk
View profile  Send private message
webdev

Posts: 19
Posted: 08/13/2006, 4:47 AM

Thanks for the info Tony...

The page was linked from a general listing of a table (a grid with a link to a specific record of the table). All the data in the record page was visible as a record. When the user hits submit button (in record page) it sends off an email to me telling me that something was changed in the database table. This is purely for testing purposes to see if the application is doing what it's supposed to be doing. (Yes, I could go look at the original listing or the database but not all the fields are present on that listing, thus the need to temporarily see if things are working ok.)

I finally ended up with the following that does work.

Mail.AddAddress CCDLookup("email", "users", "user_id=" &_
DBInternet.ToSQL(ccGetUserID, ccsInteger),DBInternet)
Mail.Subject = "Any old subject one's heart desires"

Mail.isHTML=true
Mail.Body = "There was a link updated by:<br><br>" &_
"User login name = " &_
ccdLookup("user_login","users", "user_id=" &_
DBInternet.ToSQL(links.user_id_add_by.Value, ccsInteger),DBInternet) &_

"<br>User login id = " &_
ccdLookup("user_id","users", "user_id=" &_
DBInternet.ToSQL(links.user_id_add_by.Value, ccsInteger),DBInternet) &_

"<br><br>Link details: " & links.link_url.Value &_

"<br><br>link name = " & links.link_name.Value &_

"<br><br>Description reads<br>" & links.link_desc.Value

Mail.Send
set Mail = Nothing

This pulls out the most important info on the "record" page so that I can look at it later.

However, it would be nice to generate an email with the link to that specific entry; similar to an email that I received to your reply telling me exactly where to go.

And it's a big YES to your comment:

I often use straight HTML as the body element and call the link into it that way.

Any examples would indeed help. In the aspemail manual they use some html and place it at the bottom. Unfortunately, I'm a bit concerned about just plopping code somewhere in an asp files because I'm like the "baby in the woods" when it comes to asp. Make that being a novice, newbie or whatever.

Might you know if there is a code "snippet" section anywhere in YesSoftware that one can look over for ideas? The forum is nice but the search function yields many things to read; I like reading but I also like to get to the point (solution) fast.

Thanks for the input Tony....

Wayne
View profile  Send private message
Waspman

Posts: 948
Posted: 08/13/2006, 5:34 AM

Function Data1_BeforeInsert(Sender) 'Data1_BeforeInsert @2-855FD741

'Custom Code @19-73254650
' -------------------------
Dim eBody

eBody="<table width=""100%"" border=""0"" cellpadding=""0"" cellspacing=""0"" bgcolor=""""><tr><td align=""left"" valign=""top""></td><td align=""right"" valign=""top""></td></tr></table><p> </p><p><font size=""3"" face=""Arial, Helvetica, sans-serif"">This submission has been made through the 50 years search web site:</p>"
ebody=ebody&"Submission date= "&Data1.SubDate.Value&"<br>"
ebody=ebody&"Name= "&Data1.Name.Value&"<br>"
ebody=ebody&"Title= "&Data1.Title.Value&"<br>"
ebody=ebody&"Company= "&Data1.Company.Value&"<br>"
ebody=ebody&"Address= "&Data1.Address.Value&"<br>"
ebody=ebody&"Postcode= "&Data1.Postcode.Value&"<br>"
ebody=ebody&"Tel= "&Data1.Tel.Value&"<br>"
ebody=ebody&"NOB= "&Data1.NOB.Value&"<br>"
ebody=ebody&"Email= "&Data1.Email.Value&"<br>"
ebody=ebody&"AOT= "&Data1.AOT.Value&"<br>"
ebody=ebody&"Model= "&Data1.Model.Value&"<br>"
ebody=ebody&"Purchased= "&Data1.Purchased.Value&"<br>"
ebody=ebody&"Where= "&Data1.Where1.Value&"<br><br><br>"
ebody=ebody&"<a href=""http://www.clientsite.com/50years/Subs1.asp?recordID="""&Data1.RecordID.Value&">Click to go to data</a>"

Data1.eBody.Value = eBody

Dim jmail
Set jmail = Server.CreateObject("JMail.Message")
jmail.AddRecipient "sales@Clientsite.co.uk"
jmail.From = Data1.Email.Text
jmail.Subject = "Oldest truck search submission"
jmail.HTMLBody = Data1.eBody.Text
jmail.Send( "127.0.0.1" )
'End Send Email

End Function 'Close Data1_BeforeInsert @2-54C34B28


I also use;

Data1.eBody.Value = HTMLTemplate.GetVar("Grid Trucks")

If I want an exact copy of the screen and its components - like in a cart situation.


HTH


Tony

_________________
http://www.waspmedia.co.uk
View profile  Send private message
webdev

Posts: 19
Posted: 08/13/2006, 7:46 AM

Thanks for the info Tony. I'm going to test a little later on today. I wasn't aware that one could run the html code through the asp interpreter in that fashion. It appears as a BeforeInsert. The examples that came in the Quick Start Tutorials packaged with CodeCharge show this type of thing in the AfterUpdate.

Thanks again Tony.

Wayne

View profile  Send private message
Waspman

Posts: 948
Posted: 08/13/2006, 8:54 AM

I've never had any problems this way, but I suppose the logic is that if it doesn't get inserted the email won't be sent.

Try it.




_________________
http://www.waspmedia.co.uk
View profile  Send private message
webdev

Posts: 19
Posted: 08/21/2006, 4:48 AM

Tried it and after some modifications it worked just great.

Thanks for the input Tony.

PS. Sorry it took so long to get back to you. Work, work and more work just keeps pilling up.
View profile  Send private message
Waspman

Posts: 948
Posted: 08/23/2006, 9:05 AM

Oi... How's it going with CCS?

I knew there was a reason I use this in before insert.

We developed an internal literature ordering system for the Toyota dealer network. Some of the dealers have very poor connections and ISP's.

There are occasions when an order is placed but the database isn't updated, they loose connection some of the time.

However, cos the email has been sent the marketing department are still informed and they can put the data it at their end.

;-)





_________________
http://www.waspmedia.co.uk
View profile  Send private message
webdev

Posts: 19
Posted: 09/12/2006, 8:40 PM

I'm discovering some quarks. For example, if one has a header file off the root and a directory with Images that are incorporated into the header file and then creates another supdirectory, say reports, that also incorporates the same header file from the root, one sees in the report that the same picture that did appear in any asp file at root level, disappears in any subdirectory reference to the header file. Make sense?

\ root
\ image
header file (uses an image from \image)
\reports
\reports\somefilename (uses header file at \)

images don't appear.

Got around it in quick order by creating a subdirectory off of reports: \reports\image
and then copied the pictures to that subdirectory. I would think that the interface in ccs should have taken care of references to all the other files needed to make the thing work.

Other than that, it looks ok but does require getting a little used to.

One other error I got was a missing help file. In Step 7 of the Report Builder if you click on the help button, it gives "The page cannot be displayed."

Some other things that I have not had the time to figure out center around the report printing. I would like to be able to have a user do a page setup for printing ie typical stuff like paper orientation. Now, when the report wizard goes through the process, it puts things in portrait orientation. I would like the user to be able to pass a parameter of some sort (usually a number for the orientation I think) by perhaps clicking on a radio control to pick the orientation and then generate the page. It also might be nice to allow for the setting of margins. Not asking for too much, right?


Thanks for asking. I appreciate the concern.
View profile  Send private message
peterr


Posts: 5971
Posted: 09/12/2006, 11:30 PM

This is not possible and cannot work logically, CCS interface cannot take care of this. The problem is not with the interface, but with the Header program that you create (using CCS in this case). Thus you would have the same problem whether using CCS or not, and only proper planning of your application structure can solve it. In this case one possible solution may be to use absolute image paths instead of relative.

As for printing orientation and configuration, you are probably asking for too much :-) This may be one of the most difficult things to implement in Web applications, if possible at all. If you need such detailed control of your print output then you may want to look into PDF reporting, rather than Web-based/HTML. Though even then, the server will not know your customers' printer models and they may still need to configure margins, etc. in their own printer configuration. Printer setup is dependent on each individual printer that someone may be using.
_________________
Peter R.
YesSoftware Forums Moderator
For product support please visit http://support.yessoftware.com
View profile  Send private message

Add new topic Subscribe to topic   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

MS Access to Web

Convert MS Access to Web.
Join thousands of Web developers who build Web applications with minimal coding.

CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright © 2003-2004 by UltraApps.com  and YesSoftware, Inc.