Convert SMTPsvg.Mailer to JavaScript
I have found this VBScript to perform a mailer function that I need. I am having trouble converting this to JavaScript. All of my database functions are in Java and I REALLY DONT want to have to support both languages. The line I am unable to get to work so far is:
Mailer.AddRecipient "Recipient Name","Recipient@Address.com"
VBScript (this works great):
Set Mailer = Server.CreateObject("SMTPsvg.Mailer")
Mailer.FromName = "Return Address Name"
Mailer.FromAddress = "Admin@xxxx.org"
Mailer.AddRecipient "Recipient Name","Recipient@Address.com"
Mailer.RemoteHost = "localhost"
Mailer.Subject = "Service Reminder"
Mailer.BodyText = "Text and text and text etc."
if Mailer.SendMail then
Response.Write "Mail sent...Please check for mail"
else
Response.Write "Mail send failure. Error was " & Mailer.Response
end if
JavaScript:
var Mailer = Server.CreateObject("SMTPsvg.Mailer");
Mailer.FromName = "Return Address Name";
Mailer.FromAddress = "Admin@xxxx.org";
Mailer.AddRecipient "Recipient Name","Recipient@Address.com";
Mailer.RemoteHost = "localhost";
Mailer.Subject = "Service Reminder";
Mailer.BodyText = "Text and text and text etc.";
if (Mailer.SendMail)
Response.Write "Mail sent...Please check for mail"
else
Response.Write "Mail send failure. Error was " + Mailer.Response
gives the following error:
Microsoft JScript compilation error '800a03ec'
Expected ';'
/EmailService/JavaMultipleEmails.asp, line 15
Mailer.AddRecipient "Rich Hoffmann","rich@hoffmannengineering.com";
--------------------^
Changing the offending line to:
Mailer.AddRecipient = "Rich Hoffmann","rich@hoffmannengineering.com";
yields:
Microsoft JScript runtime error '800a01b6'
Object doesn't support this property or method
/EmailService/JavaMultipleEmails.asp, line 15
Any insight will be greatly appreciated.
Rich
__________________
Ego is a faithful friend; He stays with us all the way to the crater.
|