Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

asp sendmail script - small & simple

Status
Not open for further replies.

F1lby

MIS
Oct 1, 2001
472
GB
does anyone have an asp sendmail script that works?
I'm loking for something very small and simple - no form required - just an asp that simply sends a small smtp message via the smtp server of my choice.
I can add the form elements in later - just a working script I can use and build upon using IIS6.

Rgds

Phil Blythe
 
Here's a simple subroutine to play with.
Code:
Sub SendEmail(myTo,myFrom,myCC,mySubject,myBody)
Dim myMail
SET myMail = server.CreateObject("CDONTS.NewMail")
myMail.To = myTo
myMail.From = myFrom
myMail.CC = myCC
myMail.Subject = mySubJect
myMail.BodyFormat = 0
myMail.MailFormat = 0
myMail.Body = myBody
myMail.Send
Set myMail = Nothing
END SUB
This is for sending HTML email. If you want to send plain text change the MailFormat & BodyFormat values to 1.
 
urrrr. very odd - internal server error again.
I'm having problems here...
No other error message given in the browser, just err 500 - internal server error - the server is hosting .htm & html OK. Scripting is enabled. Verrry odd indeed.


I must be missing something with regards to the server config... it's a standard build of 2003 server / IIS6.

 
asp is working fine. A simple asp hello world works fine so I think ASP is OK.
Is an IIS6 thing, as the problems I've been encountering today are all on this IIS6 box.
When I had IIS5 all was fine and no problems of any sort.

Is there something I'm not aware of in IIS6?
 
Is the CDONTS object available?

Try switching off "friendly" error messages in your browser and you may get a little more information.
Tools | Inernet Options | Advanced tab - clear check box for Show friendly HTTP messages
 
Are you using XP? If so cdonts.dll is not included. You'll have to download and register it.
 
Try CDO:

Dim objMail
Set objMail = Server.CreateObject("CDO.Message")
With objMail
.To = "them@them.com"
.CC = "her@she.com"
.From = "you@yourself.com"
.Subject = "CDO Test"
.TextBody = "Hello World"
.Send
End With
set objMail = nothing
 
Win2003 - I have been informed by a programmer that CDONTS isn't part of IIS6/Win2003.
Blew my mind to find out that Micro$oft haven't bothered to make their products backward compatible...

Anyway, done the job using PHP (which until yesterday I'd never even seen). PHP is so easy to use - food for thought....
 
F1lby,

I would agree that mailing items in PHP is tons easier, but (come on, you knew it was coming), if you wanted to redo your entire app in PHP, you'll most likely be in for a mild surprise. All-in-all yes, PHP is easier, however, you'll most likely find that the "harder, in-depth" stuff was easier in ASP ... until you feel VERY comfortable with PHP.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top