
JScript ASP Example
Here's actual working code using JScript in an Active Server Page application to send mail via VIM/MAPI/VINES/MHS:
var idsMail = Server.CreateObject("IDSMailInterface.Server");
idsMail.ObjectKey = "ABC123";
idsMail.AddRecipientTo ("Jim Smith");
idsMail.AddRecipientCc ("Mary Brown, Doug Williams");
idsMail.Subject = "Meeting Agenda";
idsMail.AddAttachment ("C:\MEETINGS\AGENDA.DOC");
idsMail.Message = "Here is the agenda for the weekly meeting.";
idsMail.Send();
var idsMail = Server.CreateObject("IDSMailInterface.Server");
idsMail.ObjectKey = "ABC123"; idsMail.AddRecipientTo ("Jim Smith");
idsMail.AddRecipientCc ("Mary Brown, Doug Williams");
idsMail.Subject = "Meeting Agenda";
idsMail.AddAttachment ("C:\MEETINGS\AGENDA.DOC");
idsMail.Message = "Here is the agenda for the weekly meeting.";
idsMail.Send();
Note that we didn't need to specify the type of E-mail system we wished to use. IDSMail automatically determined the type of E-mail present on the workstation, and sent the message accordingly.
Here is a similar example for SMTP (Internet mail):
@ LANGUAGE = JScript
var idsMail = Server.CreateObject("IDSMailInterface.Server");
idsMail.ObjectKey = "ABC123";
idsMail.MailSystem =IDSM_SYS_SMTP_POP;
idsMail.SMTPServer = "myprovider.com";
idsMail.NewMessage;
idsMail.From = "me@mycompany.com";
idsMail.AddRecipientTo ("jim@acme.com");
idsMail.AddRecipientCc ("mary@education.gov, dougw@acme.com");
idsMail.Subject = "Meeting Agenda";
idsMail.AddAttachment ("C:\MEETINGS\AGENDA.DOC");
idsMail.Message = "Here is the agenda for the weekly meeting.";
idsMail.Send();
If you wish, download our Programming Guide (140k)
|