I'm a PHP
Developer and that i have no understanding about ASP
. Sadly I'm the only real developer here along with a client had ASP
(not ASP.NET
) pages plus they wanted a "E Mail UsInch Form.
I looked the web to discover how you can serve ASP
files in Apache
also it pointed me to mod_aspdotnet
. It had been so stupid of me to consider that ASP
is equivalent to ASP.NET
! Now would you see my problem? I've created a working ASP.NET
email script. The files had .aspx
extensions however the actual site had .asp
extensions, these were using ASP
and never ASP.NET
!
So I must request for help. This really is my email script:
<%@ Page Language="VB" Debug="true" %>
<%@Import Namespace="System.Web.Mail" %>
<script language="vb" runat="server">
Sub Send2Mail (sender as Object, e as EventArgs)
Dim objMail as New MailMessage()
if Logo.HasFile Then
Try
Logo.SaveAs(Server.MapPath("uploads/") + Request.form("strName") + "_Logo_" + Logo.FileName)
objMail.Attachments.Add(new MailAttachment(Server.MapPath("uploads/" + Request.form("strName") + "_Logo_" + Logo.FileName)))
Catch ex As Exception
msg.Text = "<b>The Logo could not be uploaded</b>. The following error occured: <i>" + ex.Message + "</i><br />"
msg.Visible = true
end try
end if
if Image1.HasFile Then
Try
Image1.SaveAs(Server.MapPath("uploads/") + Request.form("strName") + "_Image1_" + Image1.FileName)
objMail.Attachments.Add(new MailAttachment(Server.MapPath("uploads/" + Request.form("strName") + "_Image1_" + Image1.FileName)))
Catch ex As Exception
msg.Text = "Image 1 could not be uploaded. The following error occured: <i>" + ex.Message + "</i><br />"
msg.Visible = true
end try
end if
if Image2.HasFile Then
Try
Image2.SaveAs(Server.MapPath("uploads/") + Request.form("strName") + "_Image2_" + Image2.FileName)
objMail.Attachments.Add(new MailAttachment(Server.MapPath("uploads/" + Request.form("strName") + "_Image2_" + Image2.FileName)))
Catch ex As Exception
msg.Text = "Image 2 could not be uploaded. The following error occured: <i>" + ex.Message + "</i><br />"
msg.Visible = true
end try
end if
objMail.To = "example@example.com"
objMail.From = """Us"" <do-not-reply@foo.com>"
objMail.BodyFormat = MailFormat.Html
objMail.Priority = MailPriority.Normal
objMail.Subject = "Business Registration"
objMail.Body = "<html><body style='font-family: Verdana'><table style='font-family: Verdana; font-size: 11px'>"
objMail.Body += "<tr><td><b>Business Name:</b></td><td>" + Request.form("strName") + "</td></tr>"
objMail.Body += "<tr><td><b>Opening Business Description:</b></td><td>" + Request.form("strOpenDesc") + "</td></tr>"
objMail.Body += "<tr><td><b>Opening Hours:</b></td><td>" + Request.form("strHours") + "</td></tr>"
objMail.Body += "<tr><td><b>Business Description:</b></td><td>" + Request.form("strBusDesc") + "</td></tr>"
objMail.Body += "<tr><td><b>Servicing Area:</b></td><td>" + Request.form("strService") + "</td></tr>"
objMail.Body += "<tr><td><b>Website Address:</b></td><td>" + Request.form("strWebsite") + "</td></tr>"
objMail.Body += "<tr><td><b>Email Address:</b></td><td>" + Request.form("strEmail") + "</td></tr>"
objMail.Body += "<tr><td><b>Telephone Number:</b></td><td>" + Request.form("strPhone") + "</td></tr>"
objMail.Body += "<tr><td><b>Fax Number:</b></td><td>" + Request.form("strFax") + "</td></tr>"
objMail.Body += "<tr><td><b>Mobile Phone Number:</b></td><td>" + Request.form("strMobile") + "</td></tr>"
objMail.Body += "<tr><td><b>Suburb / Post Code:</b></td><td>" + Request.form("strPostCode") + "</td></tr>"
objMail.Body += "<tr><td><b>Proprietor Name:</b></td><td>" + Request.form("strPropName") + "</td></tr>"
objMail.Body += "<tr><td><br /></td></tr>"
objMail.Body += "<tr><td><b>Image 1 Caption:</b></td><td>" + Request.form("strImage1Caption") + "</td></tr>"
objMail.Body += "<tr><td><b>Image 2 Caption:</b></td><td>" + Request.form("strImage2Caption") + "</td></tr>"
objMail.Body += "</table><body></html>"
SmtpMail.SmtpServer = "localhost"
Try
SmtpMail.Send(objMail)
strMessage.Visible = true
Catch ex As Exception
msg.Text = "<b>The message was not sent</b>. The following error occured: <i>" + ex.Message + "</i><br />"
msg.Visible = true
End Try
End Sub
Will the work in ASP
because it is? What should i change to really make it operate in ASP
? I'm also while using <asp:></asp:>
tags. Will the work in ASP
?
EDIT
I'm sorry for that confusion of the items server I'm using for development and also the host server. The host is applying IIS. I'm using Apache because I'm a real PHP developer. The issue about running ASP pages in Apache was since the client doesn't wish to produce use of their server. They explained which i must provide the files.