He is an example of an asp email form with Plesk in a shared environment.

 

Setup Sending Email Account:

First you will need to login into Plesk.

Next click the "Mail" tab.

Click  "create email address"

Enter the required information. Use a strong password so your account doesn't get hacked.

Write Down your email address and new password. You will need it for your script

 

This is a single page emailer.

You can copy this code to any file and change a few things to make the file work for you

create a file called contact.asp and paste below into it (you can call it whatever you want but has to end with .asp).

Remember to change these items at the top of the  script:

 

MyToAddress = "youemail@address"

MyPleskEmail = "the one you wrote down from above"

MyPleskPassword = "the password you used to create the email in plesk from above"

 

(some times copying and pasting from this webpage can have issues so you can download the file below or click it to open then copy and paste)

Download ASP file

 

 

---------------- Script Below -------------------------------

 

<%

Dim MyToAddress,MyPleskEmail,MyPleskPassword

MyToAddress = "This email address is being protected from spambots. You need JavaScript enabled to view it." 'what email address you want this to go to

MyPleskEmail = "This email address is being protected from spambots. You need JavaScript enabled to view it." 'this is used for authinication to send the email

MyPleskPassword ="The Password You made in plesk" 'this is the password for the above account

%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<html>

<head>

<meta http-equiv="content-type" content="text/html;charset=utf-8">

<title>FormMail Demo</title>

<script type="text/javascript">

function checksubmit()

{

if (/\S+/.test(document.mymailer.name.value) == false) alert ("Please provide your name.");

else if (/^\S+@[a-z0-9_.-]+\.[a-z]{2,6}$/i.test(document.mymailer.email.value) == false) alert ("A valid email address is required.");

else if (/\S+/.test(document.mymailer.comment.value) == false) alert ("Your email content is needed.");

else {

document.mymailer.submit();

}

}

</script>

</head>

<body>

<% if request.form("didsub") <> "yes" then %>

<form action="<%=request.ServerVariables("SCRIPT_NAME")%>" method="post" name="mymailer">

Whatever you want to say here<br><br>

Visitor Name: <input type="text" name="name" size="30" value=""><br>

Visitor E-Mail: <input type="text" name="email" size="30" value=""><br>

E-Mail Content: <textarea name="comment" cols="50" rows="5"></textarea><br><br>

<input type="button" value="E-Mail Me!" onclick="checksubmit();">

<input type="hidden" name="didsub" value="yes">

</form>

<% else

SendEmail MyPleskEmail,MyPleskPassword,MyToAddress

%>

<h2>Thank you for your comment!</h2>

Put what every you like here. This is displayed after the email is sent

<% end if %>

</body>

</html>

<%

sub SendEmail(MyPleskEmail,MyPleskPassword,MyToAddress)

Dim ObjSendMail

Set ObjSendMail = CreateObject("CDO.Message")

ObjSendMail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2 'Sendthe message using the network (SMTP over the network).

ObjSendMail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") ="localhost"

ObjSendMail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25

ObjSendMail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = False 'Use SSL for the connection (True or False)

ObjSendMail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout")= 60

ObjSendMail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1 'basic (clear-text) authentication

ObjSendMail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendusername")=MyPleskEmail

ObjSendMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendpassword")=MyPleskPassword

ObjSendMail.Configuration.Fields.Update

 

ObjSendMail.To = MyToAddress

ObjSendMail.Subject = "A comment from " & request.form("name")

ObjSendMail.From = request.form("email")

ObjSendMail.TextBody = RemoveHTML( request.form("comment") )

ObjSendMail.Send

Set ObjSendMail = Nothing

end sub

 

Function RemoveHTML( strText )

Dim RegEx

Set RegEx = New RegExp

RegEx.Pattern = "<[^>]*>"

RegEx.Global = True

RemoveHTML = RegEx.Replace(strText, "")

End Function

%>