Eivo Posted August 21, 2007 Share Posted August 21, 2007 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 More sharing options...
justsomeguy Posted August 21, 2007 Share Posted August 21, 2007 <% 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 More sharing options...
Eivo Posted August 21, 2007 Author Share Posted August 21, 2007 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 More sharing options...
justsomeguy Posted August 21, 2007 Share Posted August 21, 2007 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 More sharing options...
Eivo Posted August 21, 2007 Author Share Posted August 21, 2007 Thank you! Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.