Making up the emailHaving validated the email address, we need to make up the email and send it.// make up the message body
var sBody = 'Message: "' + sMessage + '"\n\n';
if ( sFromName != '' )
sBody += 'From: "' + sFromName + '".\n';
if ( sFromEmail != '' )
sBody += 'Email: "' + sFromEmail + '".\n';
|
The body of the email is very simple in this case - this form is sending the information to me, so I just declare an sBody variable and add each data on a new line ( \n is a linefeed character in JavaScript, C, C++, etc ). sBody += 'Browser: "' + Request.ServerVariables ( "HTTP_USER_AGENT" ) + '".\n';
sBody += 'IP address: "' + Request.ServerVariables ( "REMOTE_ADDR" ) + '".\n';
var dateToday = new Date();
sBody += 'Time: "' + dateToday.getHours() + ':' + dateToday.getMinutes() + '".\n';
|
Then, I add some more information to the email such as the user agent (browser) that was used, and the IP address of the sender. All this data and much more is available from the Request.ServerVariables collection. Lastly, I add the time that the email was sent - note that this is server time, not the local client time... // send Email with our generic function
SendEmail ( sFromEmail, 'Feedback@' + sHostDomain, '', sSubject, sBody );
|
...and send the email, again using a function defined in the utils/email.asp SSI. Part 4: Using the SendEmail( ) function... |