Solved

need form mail for asp site (NT)

Posted on 2013-05-22
4
445 Views
Last Modified: 2013-05-23
hi - I just transferred a website from one host to another. Its a windows based site using .asp files.  I need to get the form mail to work. Last provider had ASPMail component, this new host does not have any component and email is with a third party host - I have a plesk control web panel. anyone know how i can get form mail to work here?

using a test script i found online here:
http://www.brainjar.com/asp/formmail/
but unable to get that to work. Any advise would be great!
0
Comment
Question by:WebGirlCrissy
  • 2
  • 2
4 Comments
 
LVL 52

Accepted Solution

by:
Scott Fell,  EE MVE earned 500 total points
ID: 39189752
You just need to use cdo.  This is a great resource.  http://www.paulsadowski.com/wsh/cdo.htm

You can start with this

Set objMessage = CreateObject("CDO.Message")
objMessage.Subject = "yea mail"
objMessage.From = "me@my.com"
objMessage.To = "test@mydomain.com"
' objMessage.TextBody = "This is some sample message text."
objMessage.HTMLBody = "<h1>This is some sample message html.</h1>"
objMessage.Send

If you are on a shared host, chances are this might work.  If you need to use a remote smtp or authorize with a password check out the example, "Sending a text email using authentication against a remote SMTP server."

You might have to do a few trial and errors to get the correct settings.  I would try the simple version first.  If that does not work, you can try and ask your web host which settings will work for cdo email.  If you are using a remote smtp service then you could probably just use the given sample for remote but make sure you have the username, password, host, and port set.
0
 

Author Comment

by:WebGirlCrissy
ID: 39191969
that worked like a charm! thank you!
0
 

Author Closing Comment

by:WebGirlCrissy
ID: 39191973
thank you!
0
 
LVL 52

Expert Comment

by:Scott Fell, EE MVE
ID: 39192029
Great.  

In order to make this easy for me on multiple pages I keep this code on a separate page as a function and add it as an in include file on any page I need to send mail.

function SendMail(from,to,subject,body)

Set objMessage = CreateObject("CDO.Message") 
objMessage.Subject = subject
objMessage.From = from
objMessage.To = to
' objMessage.TextBody = "This is some sample message text." 
objMessage.HTMLBody = body
objMessage.Send 

end function

Open in new window


Sometimes  I get really fancy and have a separate template file where I keep things like the header, footer, background etc that is also in a separate include file.
function template(body)
html="<table><tr><td>header</td></tr>"
html=html&"<table><tr><td>"&body&"</td></tr>"
html=html&"<table><tr><td>footer</td></tr>"
template=html
end function

function SendMail(from,to,subject,body)

Set objMessage = CreateObject("CDO.Message") 
objMessage.Subject = subject
objMessage.From = from
objMessage.To = to
' objMessage.TextBody = "This is some sample message text." 
objMessage.HTMLBody = template(body)
objMessage.Send 

end function

Open in new window

0

Featured Post

Migrating Your Company's PCs

To keep pace with competitors, businesses must keep employees productive, and that means providing them with the latest technology. This document provides the tips and tricks you need to help you migrate an outdated PC fleet to new desktops, laptops, and tablets.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I've been asked to discuss some of the UX activities that I'm using with my team. Here I will share some details about how we approach UX projects.
An enjoyable and seamless user experience can go a long way on an eCommerce site. While a cohesive layout and engaging copy play roles in creating a positive user experience, some sites neglect aspects that seem marginal but in actuality prove very …
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

831 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question