PDA

View Full Version : Please help with e-mail and print


altpros
04-07-2005, 05:46 AM
Hallo all. I am very new to AMS and have now knowledge any code, C++, asp ect.

What I want to do is create a digital invitation on CD, like a wedding invitation.

I got everything working fine except the RSVP page. On this I have:
Input Object - Name
Input Object - Partner_1
Input Object - Contact_Number
Input Object - email
ListBox Object - Attend ...with the option Yes or No
ListBox Object - Partner_2 ...with the option Yes or No

What I was thinking of doing, is a e-mail button to e-mail the information on the page back to a specific e-mail address. Something like:

File.OpenEmail("user@yourdomain.com?&Subject=Your subject here&Body=Whatever you want as your email body here", SW_SHOWNORMAL);

Is there a way to get the information on the page into the body of the email.

Maybe with the Input.GetText and ListBox.GetSelected actions?

I also have a print button on this page so that the user can print the page/information to mail by normal mail services.

Your help will be much appreciated and thx for a great forum!!

TJ_Tigger
04-07-2005, 09:13 AM
altpros, welcome to the forums. There are several ways to accomplish what you are trying to do. It sounds like you are off to a great start as well. If you search the forums you will find examples from how to use the File.OpenEmail to constructing a mailto link to using a php script on a server to send e-mails and even a custom dll made by Worm.

My suggestion to you is to use the actions you already mentioned. Input.GetText, which returns a string, and ListBox.GetSelected (returns a table) along with ListBox.GetItemText (returns a string with the displayed text). and capture all of your data to variables. Then when you build your body you can concatenate (..) the items together in the File.OpenEmail action or in an action before. Here is an example


--obtain input object text
strName = Input.GetText("I-Name");
strPartner = Input.GetText("I-Partner");
strContact = Input.GetText("I-Contact");
strEmail = Input.GetText("I-Email");
--Get attendance option
tbSelected = ListBox.GetSelected("ListBox1");
if tbSelected ~= nil then
strAttendance = ListBox.GetItemText("ListBox1", tbSelected[1]);
else
Dialog.Message("Error", "Please select your attendance option");
return;
end
--Get partner option
tbSelected = ListBox.GetSelected("ListBox2");
if tbSelected ~= nil then
strPartner2 = ListBox.GetItemText("ListBox2", tbSelected[1]);
else
Dialog.Message("Error", "Select your partner, dosy doe.");
return;
end
--Construct Body of your e-mail
strBody = strName .. " has selected their attendance as "..strAttendance..". Their contact information is "..strContact.." and their e-mail is "..strEmail..". Partner attendance is "..strPartner2.." and the partners name is "..strPartner

File.OpenEmail("lorne@indigorose.com?subject="..strName.."%20has%20responded%20with%20a%20"..strAttendance.."&Body="..strBody, SW_SHOWNORMAL);


If you google for mailto you will find a lot of pages on how to construct the mailto information above. There is a lot that can be done to improve the code above, I would suggest error checking but hopefully this will get you started.

Tigg

altpros
04-08-2005, 01:27 AM
Tigg

Thank you for your quik response. I will try the code later today and let you know.

Thx a lot!!!!

altpros
04-11-2005, 01:00 AM
Hi Tigg

I have tried the code and that is exactly wahat I was looking for.

Just one more thing.

I have changed the code a bit. In my email body I get this:
Whoever - Yes. Contact information - 0123456789. e-mail - whoever@whatever. Partner - Yes. Partners - Whoever

Where in the code do I put "\r\n" to get:

Whoever - Yes.
Contact information - 0123456789
e-mail - whoever@whatever.
Partner - Yes
Partners name - Whoever

Thx Altpros

JimS
04-11-2005, 05:02 AM
At the same place you have your periods(.) in your example 'email body'
;)

Seriously.



.

altpros
04-11-2005, 08:25 AM
JimS

Tanks for your response.

If you look at my first post, you will see that I have stated that I don't know anything about all this code.:-(

I had a look in the forums and the help file and tried with " .. () all that I can think of as well as before and after all this stuff. But get an error every time.

This is my first project and I must admit that the code don't make any sense to me. Call me stupid if you want;-)

OK let's try this. At the moment I have this:
strBody = strName .. " - "..strAttendance..". Contact number - "..strContact.." e-mail - "..strEmail..". Partner - "..strPartner2.." Partners name - "..strPartner

Would you please be so kind and give me an example as to where I must put in "\r\n"

TJ_Tigger
04-11-2005, 08:35 AM
Try this:

strBody = strName .. " - "..strAttendance.."./r/nContact number - "..strContact.." /r/ne-mail - "..strEmail..". /r/nPartner - "..strPartner2.." /r/nPartners name - "..strPartner

as JimS noted, put the /r/n where ever you have a period and make sure it is within the quotation marks. I placed the /r/n before each item where you wanted a new line. Let me know how it works.

Tigg

altpros
04-11-2005, 09:26 AM
Tigg

Tried it and are getting this:
Whoever - Yes. /r/nContact information - 0123456789. /r/ne-mail - whoever@whatever. /r/nPartner - Yes. /r/nPartners - Whoever

I also tried \r\n where you have indicated, but that do not change anything?

Thx for the help

TJ_Tigger
04-11-2005, 09:31 AM
silly me, I put the wrong slashes in there.

strBody = strName .. " - "..strAttendance..".\r\nContact number - "..strContact.." \r\ne-mail - "..strEmail..". \r\nPartner - "..strPartner2.." \r\nPartners name - "..strPartner

altpros
04-11-2005, 09:50 AM
Tigg

Tried it, but still put it in one line.

Another qeustion. What type/language is this code? Maybe I can enroll somewhere to learn this!

altpros
04-11-2005, 10:02 AM
Tigg

See that it was your birthday on the 4th of April!!!

Congratulation!!!!!!!!!!

Hope you had a great day and that you have a great year!!

(I am Afrikaans speaking. So please ignore spelling, tenses ...has, have, had ect.)

TJ_Tigger
04-11-2005, 11:15 AM
Tigg

Tried it, but still put it in one line.

Another qeustion. What type/language is this code? Maybe I can enroll somewhere to learn this!

altpros,

The language that is used is LUA. You can find additional information about LUA at www.lua.org.

Thanks for the b-day wishes.

Tigg

JimS
04-11-2005, 03:57 PM
altpros, I would never think of calling you stupid. I did think that I could do more to help you if I gave you a hint, rather than just giving you the answer that you could cut and paste.

I figure that a cut and paste answer would only help answer this question, but my hint might help you better understand concatenation, especially if it meant you had to try it a couple of different times before you got exactly what you wanted.

There is a notion in my country, that it is better to help teach a man how to fish, rather than just giving him a fish.

I meant you no disrespect.

By the way, welcome to the forums. :p


.

altpros
04-12-2005, 12:49 AM
JimS

No offence taken.

I did try a few options thow before asking. Tigg gave me an example but I still get everything in one line.

Maybe you can give me another hint.

Thanx for the help.

JimS
04-12-2005, 05:42 AM
altpros, I’m shocked that it didn’t work, Tigger’s code is exactly what I expected to work, however I can confirm that it doesn’t in my version of Outlook.

Try this:

strBody = strName .. " - "..strAttendance.."%0dContact number - "..strContact.."%0de-mail - "..strEmail.."%0dPartner - "..strPartner2.."%0dPartners name - "..strPartner

I can’t guarantee that it will work with all email clients, but it works with Outlook 2002 SP3

I think that that is one of the greatest things about trying to help someone, I usually end up learning something myself. :p

Good luck. :yes

.

TJ_Tigger
04-12-2005, 07:37 AM
That darn "not testing code" bites me again. I forgot that it is not a regular string.

Nice catch JimS

JimS
04-12-2005, 07:47 AM
Thanks Tigger, but the real credit goes to you, I just tweaked your code a bit :)


.

altpros
04-13-2005, 01:00 AM
Hey guys

Thanks for the help. I tried it but still doesn't work.

Maybe it is Incredimail, which I am using.

TJ_Tigger
04-13-2005, 07:45 AM
Hey guys

Thanks for the help. I tried it but still doesn't work.

Maybe it is Incredimail, which I am using.

altpros, have you tried building a mailto link that would be used on a web page and tried to open the e-mail that way? or you might be able to run it from the run dialog as well, Start-Run. See how it works when you do that.

Here (http://www.cmg02.com/cg2/mailto.htm) is a generator to build and test the link.

TJ_Tigger
04-13-2005, 07:47 AM
You can try this as well. I think that you can use 0A0D for a line break in html, it is like the \r\n that lua uses.


strBody = strName .. " - "..strAttendance.."%0a%0dContact number - "..strContact.."%0a%0de-mail - "..strEmail.."%0a%0dPartner - "..strPartner2.."%0a%0dPartners name - "..strPartner

Intrigued
04-13-2005, 09:03 AM
You can try this as well. I think that you can use 0A0D for a line break in html, it is like the \r\n that lua uses.


strBody = strName .. " - "..strAttendance.."%0a%0dContact number - "..strContact.."%0a%0de-mail - "..strEmail.."%0a%0dPartner - "..strPartner2.."%0a%0dPartners name - "..strPartner

One thing, without trying this exact code, is that I see Tigger... that the concatenation characters (..) past the strParner2 will be a problem. There needs to be spaces at least before the first dot (the one next to the number 2).