Jump to content

VBscript -> JScript


Eivo

Recommended Posts

I am not all too familiar with VBscript and I use Jscript for my ASP. I have a snip of VB code that works but I want to get it to work in Jscript so I can keep everything on my sites uniform.Here is the VB:

<% Set Mail = Server.CreateObject("SMTPsvg.Mailer")Mail.FromName   = Request.Form("name")Mail.FromAddress= Request.Form("e_mail")Mail.RemoteHost = "mrelay.perfora.net"Mail.AddRecipient "Name", "email@address.com"Mail.Subject	= "Website - Comments"Mail.BodyText   = Request.Form("comment")%>

I know the "Set" needs to become my "var" but if it is possible to write this in Jscript, I would really appreciate the help. Thank you.

Link to comment
Share on other sites

<% var Mail = Server.CreateObject("SMTPsvg.Mailer");Mail.FromName   = Request.Form("name");Mail.FromAddress= Request.Form("e_mail");Mail.RemoteHost = "mrelay.perfora.net";Mail.AddRecipient("Name", "email@address.com");Mail.Subject	= "Website - Comments";Mail.BodyText   = Request.Form("comment");%>

It doesn't look like the mail is actually being sent but that's the general idea.

Link to comment
Share on other sites

Oh crap, I did forget part of the code. Sorry.Here it is in VB again.

Set Mail = Server.CreateObject("SMTPsvg.Mailer")Mail.FromName   = Request.Form("name")Mail.FromAddress= Request.Form("e_mail")Mail.RemoteHost = "mrelay.perfora.net"Mail.AddRecipient "Name", "email@address.com"Mail.Subject	= "Website - Comments"Mail.BodyText   = Request.Form("comment")if Mail.SendMail then Response.Write "Thank You!"else Response.Write "Mail send failure. Error was " & Mail.Responseend if

Link to comment
Share on other sites

This it the if structure in jscript:

if (Mail.SendMail())  Response.Write("Thank You!");else  Response.Write("Mail send failure. Error was " + Mail.Response);

If Mail.Response is a method instead of a property you'll need to add parens after it.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...