VPS 및 전용 서버(호스팅 컨트롤 센터) 도움말

Create an ASP form mailer

Some of the information in this article is advanced material we make available as a courtesy. Please be advised that you are responsible for properly following the procedures below. Customer Support cannot assist with these topics.

To use an ASP form-mailer on a Windows Dedicated or Virtual Private Server (VPS), create a Web form in HTML that links to an ASP file, then upload it to your server. An example script is seen below:

<%
'Form should include a hidden field named redirect otherwise the user will be redirected to the home page

'Required settings - these must be set for this script to work
mail_to = "mary@secureserver.net"
mail_from = "test@secureserver.net"

On Error Resume Next

host_url = Request.ServerVariables("HTTP_HOST")
req_method = Request.ServerVariables("REQUEST_METHOD")

mail_body = vbCrLf

'Gather form submission items and translate into message body
If err.number <> 0 Then
Response.Write "Error processing mail request. Error code: " & err.number
Else
If (req_method = "GET") Then
For Each Item In request.QueryString
If item <> "" Then
key = item
value = Request.QueryString(item)
If(lcase(key) = "redirect") Then
landing_page = value
Else
mail_body = mail_body + ucase(key) + ": " + value + vbCrLf
End If
End If
Next
ElseIf (req_method = "POST") Then
For Each Item In request.form
If item <> "" Then
key = item
value = Request.Form(item)
If(lcase(key) = "redirect") Then
landing_page = value
Else
mail_body = mail_body + ucase(key) + " " + value + vbCrLf
End If
End If
Next
End If
End If

'Generate mail message.
If err.number <> 0 Then Response.Write "Error processing mail request. Error code: " & err.number Else Set msg = Server.CreateObject("CDO.Message") Set myCon = Server.CreateObject ("CDO.Configuration") 'Out going SMTP server myCon.Fields("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "localhost" myCon.Fields("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2 myCon.Fields.Update msg.Configuration = myCon msg.Subject = "Message from " & host_url msg.From = mail_from msg.To = mail_to msg.TextBody = mail_body msg.Send Set msg = Nothing End If If err.number <> 0 Then Response.Write "Error processing mail request. Error code: " & err.number Else If landing_page <> "" Then Response.Redirect landing_page Else Response.Redirect host_url End If End If %>

이 글이 도움되었나요?
피드백을 보내주셔서 감사합니다. 고객 서비스 담당자에게 문의하시려면 지원 전화 번호 또는 위의 채팅 옵션을 이용하시기 바랍니다.
도와드릴 수 있어 기쁩니다! 더 도와 드릴 것이 있나요?
그것 유감스럽습니다. 혼동이 되었던 사항 또는 솔루션이 고객님의 문제를 해결하지 못했던 원인을 알려주세요.