Open Your Email From a Sesame Record
From the Inside Sesame Help Desk
I would like to use the "send an email" option in the sample "Fun stuff" database from the FirstLook sample application that comes with Sesame 2.
To simplify things, my application has three elements:
1. client name
2. parent1 email
3. parent2 email
Upon receiving a registration form and deposit and entering their info I would like to send the client a confirmation notice. So, after entering the information from their registration form I would like to click on the "send an email" button and have it open to my email with the client's email addresses listed in the send to box and "Registration Confirmation" in the subject box. Where and how do I place my client's email addresses and my own subject ("Registration Confirmation") in the programming that came with the sample? When I click on FirstLook's send an email button, it opens my email program (Microsoft Outlook 2007) with Lantica's email address in the send to box and "message about Sesame database manager" in the subject box. I would also like the ability to put a message in the email if possible.
Peter
So let's look at the solution that will do what you need. Add another text field in your database for your message. Name it Message. You could even give it an Initial Value with the basic message in it. This way you can change your message for different people by modifying this field. The trick for email is to not use carriage returns in the field but to use the characters %0D%0A instead (That's percent-zero-capital D-percent-zero-capital A). This isn't a Sesame thing - it's what the MailTo command in Windows requires to encode the message for an email program. But we'll give you a way around that also.
So, if you want the body of your message to read:
This is what you want on the first line Thank you for your registration fee Peter
The data in the field must eventually read like this:
This is what you want on the first line%0D%0AThank you for your registration fee%0D%0APeter
Note the absence of line breaks and spaces before the special encoding characters. So, let's make Sesame do that and the mailing at the same time.
Add a command button to your form. In the On-Element-Entry event of that button you put programming as follows:
var vTemp as Int vTemp = @AsynchShell("mailto:"+parent1 email+"?Subject=Registration Confirmation For "+client name+"&CC="+parent2 email+"&body="+@Replace(Message, @NL(), "%0D%0"))
This will put in both parent addresses and the name of the client in the subject line along with the data from the Message field in the body of the email (in the right format for MailTo. Pay very close attention to the placement of the quotation marks when you do this.