Wrox Home  
Search P2P Archive for: Go

  Return to Index  

asp_databases thread: Sending email


Message #1 by "Nick Middleweek" <nickm@t...> on Fri, 25 Aug 2000 10:31:57 +0000
Hello,



Does anyone know of a way to send email from an ASP page.



I'll be using it to send out confirmations when the users place orders. I

want to have feature that allows other users send our pages to their friends

via email, i.e. "Email this article to a friend." - the article will be

created on the fly from the db.



I'm also going to use this email so to inform me if backups fail of the SQL

Server or the UPS software has decided that it's time to shut down the

server.



Another one is to have HTML newsletters.



Does anyone know of how I can achieve this? Has anyone heard of BLAT?

Are they extensions already built into W2K that allow this to happen?





TIA

Nick Middleweek

Message #2 by "Ray Murphy" <raymondmurphy@c...> on Sat, 26 Aug 2000 13:51:46
Nick,



There are probably a number of ways to send mail, so I think you'll be 

getting a variety of replies to this one.



Here is one method that I have been using with no problems so far :



 <%

    Dim strHTML

    strHTML = "<HTML>"

    strHTML = strHTML & "<HEAD>"

    strHTML = strHTML & "<TITLE>Order Completion</TITLE>"

    strHTML = strHTML & "</HEAD>"

    strHTML = strHTML & "<BODY>"

    strHTML = strHTML & "<P>Order Placed at <STRONG>" & Time & "</STRONG>"

    strHTML = strHTML & "</BODY>" 

    strHTML = strHTML & "</HTML>"

        

    set NewMail = Server.CreateObject("CDONTS.NewMail")

    NewMail.From = "customer@c..."

    NewMail.To   = "billy@b..."

    NewMail.CC = "bobby@b..."

    NewMail.BCC = "benny@b..."

    NewMail.BodyFormat = CdoBodyFormatHTML

    NewMail.Body = strHTML

    

    NewMail.Subject = "Customer Placed An Order"

       

    NewMail.Send

    Set NewMail = Nothing

 %>



Hope this is of some use.





Ray

Message #3 by "Nick Middleweek" <nickm@t...> on Wed, 30 Aug 2000 09:44:45 +0000
Thanks for the replies on this.



I think I'll probably write a generic function that accepts a number of

parameters to build and send the message.



So I assume that CDONTS is already installed when IIS gets installed. Are

there any other configurations and tweaks that need to be done to the

machine in order for this to work?



Is there any documentation on this useful object?



I'd like to find out more about the advanced functionality it has to offer -

if any? What if I send an email in HTML but the client who receives it only

supports plain text? Will the email automatically display a plain text

version?



Are there any other things like this that may help with my development

plans?





Thanks

Nick



----------

> Nick,

>

> There are probably a number of ways to send mail, so I think you'll be

> getting a variety of replies to this one.

>

> Here is one method that I have been using with no problems so far :

>

>  <%

>     Dim strHTML

>     strHTML = "<HTML>"

>     strHTML = strHTML & "<HEAD>"

>     strHTML = strHTML & "<TITLE>Order Completion</TITLE>"

>     strHTML = strHTML & "</HEAD>"

>     strHTML = strHTML & "<BODY>"

>     strHTML = strHTML & "<P>Order Placed at <STRONG>" & Time & "</STRONG>"

>     strHTML = strHTML & "</BODY>"

>     strHTML = strHTML & "</HTML>"

>

>     set NewMail = Server.CreateObject("CDONTS.NewMail")

>     NewMail.From = "customer@c..."

>     NewMail.To   = "billy@b..."

>     NewMail.CC = "bobby@b..."

>     NewMail.BCC = "benny@b..."

>     NewMail.BodyFormat = CdoBodyFormatHTML

>     NewMail.Body = strHTML

>

>     NewMail.Subject = "Customer Placed An Order"

>

>     NewMail.Send

>     Set NewMail = Nothing

>  %>

>

> Hope this is of some use.

>

>

> Ray

Message #4 by "Nick Middleweek" <nickm@t...> on Wed, 30 Aug 2000 09:58:46 +0000
I've just tried it.



How does it know what mail server to use to send the mail?

And what about the login and user ID?





TIA!



Nick







----------

> Nick,

>

> There are probably a number of ways to send mail, so I think you'll be

> getting a variety of replies to this one.

>

> Here is one method that I have been using with no problems so far :

>

>  <%

>     Dim strHTML

>     strHTML = "<HTML>"

>     strHTML = strHTML & "<HEAD>"

>     strHTML = strHTML & "<TITLE>Order Completion</TITLE>"

>     strHTML = strHTML & "</HEAD>"

>     strHTML = strHTML & "<BODY>"

>     strHTML = strHTML & "<P>Order Placed at <STRONG>" & Time & "</STRONG>"

>     strHTML = strHTML & "</BODY>"

>     strHTML = strHTML & "</HTML>"

>

>     set NewMail = Server.CreateObject("CDONTS.NewMail")

>     NewMail.From = "customer@c..."

>     NewMail.To   = "billy@b..."

>     NewMail.CC = "bobby@b..."

>     NewMail.BCC = "benny@b..."

>     NewMail.BodyFormat = CdoBodyFormatHTML

>     NewMail.Body = strHTML

>

>     NewMail.Subject = "Customer Placed An Order"

>

>     NewMail.Send

>     Set NewMail = Nothing

>  %>

>

> Hope this is of some use.

>

>

> Ray

>

> ---

> You are currently subscribed to asp_databases


> 

Message #5 by "Ray Murphy" <raymondmurphy@c...> on Wed, 30 Aug 2000 15:49:28 +0100
Nick,



Take a look at http://www.cdolive.com/asp.htm - lots of useful info there.





Ray

Message #6 by "Nick Middleweek" <nickm@t...> on Wed, 30 Aug 2000 17:51:58 +0000
I've discovered that I need to have the SMTP service installed and 

configured correctly on the web server.



Doenyone know how I can set this up properly - I've read the Help but no

joy!



I've got an email server on our Proxy/Firewall machine. When I send email

from VBS or ASP I assume that somehow I need to tell SMTP service to connect

to the other email server?

Is this right?

How do I do this?

I'm completely lost with this - Is SMTP services like exchange (not that I

know about exchange!)?





Hope someone can help!



Regards

Nick





----------

> Nick,

>

> Take a look at http://www.cdolive.com/asp.htm - lots of useful info there.

>

>

> Ray

>

> ---

> You are currently subscribed to asp_databases


> 

Message #7 by Chris Neale <Chris.Neale@s...> on Thu, 31 Aug 2000 08:18:25 +0100
Theres a groovy little command line program called Blat that does SMTP on NT

and 9*.. its pretty much identical to Sendmail on *nix systems.. I believe

it comes with a couple of ASP examples too. www.blat.com

<http://www.blat.com>  probably.. else do a search..



Chris



Chaos! Panic! Disaster! (My work here is done)

Chris Neale. Web/Wap Developer

Chris.neale@s... <mailto:Chris.neale@s...> 

www.sparkresponse.co.uk



	-----Original Message-----

	From:	Nick Middleweek 

	Sent:	Wednesday, August 30, 2000 6:52 PM

	To:	ASP Databases

	Subject:	[asp_databases] Re: Sending email



	I've discovered that I need to have the SMTP service installed and 

	configured correctly on the web server.



	Doenyone know how I can set this up properly - I've read the Help

but no

	joy!



	I've got an email server on our Proxy/Firewall machine. When I send

email

	from VBS or ASP I assume that somehow I need to tell SMTP service to

connect

	to the other email server?

	Is this right?

	How do I do this?

	I'm completely lost with this - Is SMTP services like exchange (not

that I

	know about exchange!)?





	Hope someone can help!



	Regards

	Nick





	----------

	> Nick,

	>

	> Take a look at http://www.cdolive.com/asp.htm - lots of useful

info there.

	>

	>

	> Ray

	>

Message #8 by "Ken Schaefer" <ken@a...> on Thu, 31 Aug 2000 11:31:46 +1000
Nick,



To install the SMTP service run the NT Option Pack setup again. It is an

optional component.



The SMTP service runs as a SMTP server. CDONTS just creates a validly

formatted email message and drops it into the "incoming" directory of the

SMTP service. The SMTP service then attempts to resolve the MX DNS record

for the domain the message is being sent to, and delivers the mail.



There is no need, in this case, for you to interact with the SMTP server

running on your firewall/proxy.



Otherwise, if you want to make use of your existing SMTP server (running on

the firewall), go to http://tech.dimac.net and download their JMail

component (free). This lets you specify which SMTP server you want to use to

deliver the mail.



I think, if you really want to understand this more, you'll need to do a bit

of reading on SMTP (and the difference between SMTP and POP) and DNS.

Looking up the relevant RFCs is probably a good place to start eg

http://www.faqs.org/rfcs/



Cheers

Ken



----- Original Message -----

From: "Nick Middleweek" 

To: "ASP Databases" <asp_databases@p...>

Sent: Thursday, August 31, 2000 3:51 AM

Subject: [asp_databases] Re: Sending email





> I've discovered that I need to have the SMTP service installed and

> configured correctly on the web server.

>

> Doenyone know how I can set this up properly - I've read the Help but no

> joy!

>

> I've got an email server on our Proxy/Firewall machine. When I send email

> from VBS or ASP I assume that somehow I need to tell SMTP service to

connect

> to the other email server?

> Is this right?

> How do I do this?

> I'm completely lost with this - Is SMTP services like exchange (not that I

> know about exchange!)?

>

>

> Hope someone can help!

>

> Regards

> Nick





Message #9 by "Nick Middleweek" <nickm@t...> on Thu, 31 Aug 2000 10:12:06 +0000
Thanks Ken,



I'm using W2K so do you know of any differences between it and NT4?



So what it seems, is that the SMTP service makes the server machine act as a

'sort of' mail server?



This JMail component? Is that a globally recognised add-on to Windows

Servers - just like Blat, I'm not too keen on installing third party add-ons

to reduce crashes, etc.



Which is the preferred component? Which is easier?



If I want to use CDONTS, then I have to setup the SMTP service on my server

which I lack understanding of. Do I have to install/configure any additional

things if I want to use JMail that you know of?



Have you ever used the Queue option in JMail for sending lots of emails? It

appears to dump them in a folder similar to SMTP and wait for 'mailservice'

to pick them up and then send them. - Have you any clues on what the mail

service is? Am I write in saying that I'll need to setup SMTP to use the

email Queing?



Even without queues, this component looks great - it's got a lot of

additional features that will make life easier. Are there a list of sites

that have more of these cool components?





Regards

Nick





----------

> Nick,

>

> To install the SMTP service run the NT Option Pack setup again. It is an

> optional component.

>

> The SMTP service runs as a SMTP server. CDONTS just creates a validly

> formatted email message and drops it into the "incoming" directory of the

> SMTP service. The SMTP service then attempts to resolve the MX DNS record

> for the domain the message is being sent to, and delivers the mail.

>

> There is no need, in this case, for you to interact with the SMTP server

> running on your firewall/proxy.

>

> Otherwise, if you want to make use of your existing SMTP server (running on

> the firewall), go to http://tech.dimac.net and download their JMail

> component (free). This lets you specify which SMTP server you want to use to

> deliver the mail.

>

> I think, if you really want to understand this more, you'll need to do a bit

> of reading on SMTP (and the difference between SMTP and POP) and DNS.

> Looking up the relevant RFCs is probably a good place to start eg

> http://www.faqs.org/rfcs/

>

> Cheers

> Ken

>

> ----- Original Message -----

> From: "Nick Middleweek"

> To: "ASP Databases" <asp_databases@p...>

> Sent: Thursday, August 31, 2000 3:51 AM

> Subject: [asp_databases] Re: Sending email

>

>

>> I've discovered that I need to have the SMTP service installed and

>> configured correctly on the web server.

>>

>> Doenyone know how I can set this up properly - I've read the Help but no

>> joy!

>>

>> I've got an email server on our Proxy/Firewall machine. When I send email

>> from VBS or ASP I assume that somehow I need to tell SMTP service to

> connect

>> to the other email server?

>> Is this right?

>> How do I do this?

>> I'm completely lost with this - Is SMTP services like exchange (not that I

>> know about exchange!)?

>>

>>

>> Hope someone can help!

>>

>> Regards

>> Nick

>

>

>

> ---

> You are currently subscribed to asp_databases


> 

Message #10 by "Nick Middleweek" <nickm@t...> on Thu, 31 Aug 2000 09:19:54 +0000
I was considering using Blat but after searching for it and viewing the 

site, the developers say there's no support, they haven't tested it on all

platforms and it's up to us to decide whether it's Y2k compliant.



I don't really like using untested, no-backup applications on the web server

- to reduce problems if any. It's good to hear that someone else is using it

though!





Regards

Nick



----------

> Theres a groovy little command line program called Blat that does SMTP on NT

> and 9*.. its pretty much identical to Sendmail on *nix systems.. I believe

> it comes with a couple of ASP examples too. www.blat.com

> <http://www.blat.com>  probably.. else do a search..

>

> Chris

>

> Chaos! Panic! Disaster! (My work here is done)

> Chris Neale. Web/Wap Developer

> Chris.neale@s... <mailto:Chris.neale@s...>

> www.sparkresponse.co.uk

>

>  -----Original Message-----

>  From: Nick Middleweek

>  Sent: Wednesday, August 30, 2000 6:52 PM

>  To: ASP Databases

>  Subject: [asp_databases] Re: Sending email

>

>  I've discovered that I need to have the SMTP service installed and

>  configured correctly on the web server.

>

>  Doenyone know how I can set this up properly - I've read the Help

> but no

>  joy!

>

>  I've got an email server on our Proxy/Firewall machine. When I send

> email

>  from VBS or ASP I assume that somehow I need to tell SMTP service to

> connect

>  to the other email server?

>  Is this right?

>  How do I do this?

>  I'm completely lost with this - Is SMTP services like exchange (not

> that I

>  know about exchange!)?

>

>

>  Hope someone can help!

>

>  Regards

>  Nick

>

>

>  ----------

>  > Nick,

>  >

>  > Take a look at http://www.cdolive.com/asp.htm - lots of useful

> info there.

>  >

>  >

>  > Ray

>  >

>

> ---

> You are currently subscribed to asp_databases


> 

Message #11 by "Ken Schaefer" <ken@a...> on Thu, 31 Aug 2000 21:19:31 +1000
> I'm using W2K so do you know of any differences between it and NT4?



None that I'm aware of.



> So what it seems, is that the SMTP service makes the server machine act as

a

> 'sort of' mail server?



It acts as one half of a mail server. It acts as the SMTP part, which

delivers and receives mail.

Most mailservers also come with another part called a POP3 server. This

takes mail received by the SMTP server which is destined for your domain and

divides it up into mailboxes, and then handles connections from clients who

want to read their mail.





> This JMail component? Is that a globally recognised add-on to Windows

> Servers - just like Blat, I'm not too keen on installing third party

add-ons

> to reduce crashes, etc.



It's quite popular. There's a few popular components, JMail is one. ASPMail

is another.

I wouldn't use Blat, as that requires you to (AFAIK) to write a COM wrapper,

and then use that to call the Blat executable, which would run outside the

IIS process...which is not as good performance wise as using an in-process

component.



I've been using JMail for a while and I've never had any problems with it,

in terms of server stability.



> If I want to use CDONTS, then I have to setup the SMTP service on my

server

> which I lack understanding of. Do I have to install/configure any

additional

> things if I want to use JMail that you know of?



JMail requires you to have an SMTP server somewhere...any email delivery

does. But it allows you to specify an existing SMTP server, so you could use

the one your company already has. CDONTS only works with the SMTP server

that comes with the NT Option Pack.





JMail works by connecting to the SMTP server like an email program does, ie

it uses Windows Sockets to open a TCP connection to port 25 of the SMTP

server and sends the same commands that Outlook or Eudora would send.



CDONTS works by writing a textfile and dropping that into the "incoming"

directory of the NT SMTP service, and then the SMTP service processes that.



> Even without queues, this component looks great - it's got a lot of

> additional features that will make life easier. Are there a list of sites

> that have more of these cool components?



Very probably - look around http://www.15seconds.com or www.learnasp.com or

www.asphole.com or any of the popular ASP sites.



Cheers

Ken



Message #12 by "Nick Middleweek" <nickm@t...> on Thu, 31 Aug 2000 13:06:38 +0000
Once again, thanks!



Have you used the Queue feature. The documentation on the tech.dimac.net

site says:

<http://tech.dimac.net/isapiscript.dll?action=read&id=32559&exId=32574>



' Instead of using the Send() method, we use nq

' The email will be placed in the mail queue and sent

' as soon as the mailservice picks it up.

' We do not need to specify a mailserver, as the

' mailservice does all that for us.



' What we do need to do is to specify where the MS pickup

' directory is. If you are running w3 JMail on a

' Windows 2000 server, this is not neccessary, otherwise



' Unless you are running windows 2000 on your webserver,

' you will need to specify where the MS pickup directory

' is (c:\inetpub\mailroot\pickup\).





What is it that picks up the mail? What is the mailservice? Is this SMTP?



I assume you prefer JMail to ASPmail?





Regards

Nick Middleweek





----------

>From: "Ken Schaefer" <ken@a...>

>To: "ASP Databases" <asp_databases@p...>

>Subject: [asp_databases] Re: Sending email

>Date: Thu, Aug 31, 2000, 11:19

>



>> I'm using W2K so do you know of any differences between it and NT4?

>

> None that I'm aware of.

>

>> So what it seems, is that the SMTP service makes the server machine act as

> a

>> 'sort of' mail server?

>

> It acts as one half of a mail server. It acts as the SMTP part, which

> delivers and receives mail.

> Most mailservers also come with another part called a POP3 server. This

> takes mail received by the SMTP server which is destined for your domain and

> divides it up into mailboxes, and then handles connections from clients who

> want to read their mail.

>

>

>> This JMail component? Is that a globally recognised add-on to Windows

>> Servers - just like Blat, I'm not too keen on installing third party

> add-ons

>> to reduce crashes, etc.

>

> It's quite popular. There's a few popular components, JMail is one. ASPMail

> is another.

> I wouldn't use Blat, as that requires you to (AFAIK) to write a COM wrapper,

> and then use that to call the Blat executable, which would run outside the

> IIS process...which is not as good performance wise as using an in-process

> component.

>

> I've been using JMail for a while and I've never had any problems with it,

> in terms of server stability.

>

>> If I want to use CDONTS, then I have to setup the SMTP service on my

> server

>> which I lack understanding of. Do I have to install/configure any

> additional

>> things if I want to use JMail that you know of?

>

> JMail requires you to have an SMTP server somewhere...any email delivery

> does. But it allows you to specify an existing SMTP server, so you could use

> the one your company already has. CDONTS only works with the SMTP server

> that comes with the NT Option Pack.

>

>

> JMail works by connecting to the SMTP server like an email program does, ie

> it uses Windows Sockets to open a TCP connection to port 25 of the SMTP

> server and sends the same commands that Outlook or Eudora would send.

>

> CDONTS works by writing a textfile and dropping that into the "incoming"

> directory of the NT SMTP service, and then the SMTP service processes that.

>

>> Even without queues, this component looks great - it's got a lot of

>> additional features that will make life easier. Are there a list of sites

>> that have more of these cool components?

>

> Very probably - look around http://www.15seconds.com or www.learnasp.com or

> www.asphole.com or any of the popular ASP sites.

>

> Cheers

> Ken

>

>

> ---

> You are currently subscribed to asp_databases



  Return to Index