Solved

need form mail for asp site (NT)

Posted on 2013-05-22
4
440 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

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

Most ColdFusion developers get confused between the CFSet, Duplicate, and Structcopy methods of copying a Structure, especially which one to use when. This Article will explain the differences in the approaches with examples; therefore, after readin…
Article by: kevp75
Hey folks, 'bout time for me to come around with a little tip. Thanks to IIS 7.5 Extensions and Microsoft (well... really Windows 8, and IIS 8 I guess...), we can now prime our Application Pools, when IIS starts. Now, though it would be nice t…
Viewers will get an overview of the benefits and risks of using Bitcoin to accept payments. What Bitcoin is: Legality: Risks: Benefits: Which businesses are best suited?: Other things you should know: How to get started:
The viewer will learn how to count occurrences of each item in an array.

743 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now