new record, mail to someone

new record, mail to someone

Post by Lee, M » Tue, 17 Aug 1999 04:00:00



Dear all,

Is anyone know how to send a mail to someone when there is new record being
added into a table ??
Am i suppose to use trigger ?? how to use it ??

Thanks.

Lee, MY

 
 
 

new record, mail to someone

Post by Neil Pik » Tue, 17 Aug 1999 04:00:00


Lee - yes, use a trigger and call xp_cmdshell from it.  There are examples of
triggers in the BOL

Quote:> Is anyone know how to send a mail to someone when there is new record being
> added into a table ??
> Am i suppose to use trigger ?? how to use it ??

 Neil Pike MVP/MCSE.  Protech Computing Ltd
 (Please reply only to newsgroups)
 For SQL FAQ entries see

 or www.ntfaq.com/sql.html (+ ntfaq download)
 or http://www.swynk.com/faq/sql/sqlserverfaq.asp
 or http://www.sql-server.co.uk

 
 
 

new record, mail to someone

Post by James Talbu » Wed, 18 Aug 1999 04:00:00



Quote:> Lee - yes, use a trigger and call xp_cmdshell from it.  There are examples
of
> triggers in the BOL

Neil,

Why xp_cmdshell?
Surely xp_sendmail would be more use if he wants to send mail, or are you
hiding a secret somewhere?

J.T.

 
 
 

new record, mail to someone

Post by Neil Pik » Wed, 18 Aug 1999 04:00:00


JT - nope, just a typo.  xp_sendmail would be the thing!

Quote:> Surely xp_sendmail would be more use if he wants to send mail, or are you
> hiding a secret somewhere?

 Neil Pike MVP/MCSE.  Protech Computing Ltd
 (Please reply only to newsgroups)
 For SQL FAQ entries see

 or www.ntfaq.com/sql.html (+ ntfaq download)
 or http://www.swynk.com/faq/sql/sqlserverfaq.asp
 or http://www.sql-server.co.uk
 
 
 

new record, mail to someone

Post by rpos.. » Wed, 18 Aug 1999 04:00:00


xp_sendmail will require ms exchange, and also a profile set up on the
machine, right?

SMTP is simpler.  how would you do it using SMTP, apart from using a
com object?



> JT - nope, just a typo.  xp_sendmail would be the thing!

> > Surely xp_sendmail would be more use if he wants to send mail, or
are you
> > hiding a secret somewhere?

>  Neil Pike MVP/MCSE.  Protech Computing Ltd
>  (Please reply only to newsgroups)
>  For SQL FAQ entries see

>  or www.ntfaq.com/sql.html (+ ntfaq download)
>  or http://www.swynk.com/faq/sql/sqlserverfaq.asp
>  or http://www.sql-server.co.uk

Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
 
 
 

new record, mail to someone

Post by James Talbu » Thu, 19 Aug 1999 04:00:00



Quote:> xp_sendmail will require ms exchange, and also a profile set up on the
> machine, right?

> SMTP is simpler.  how would you do it using SMTP, apart from using a
> com object?

Ahah, yet another opportunity to gratuitously advertise my xp:
http://www.spudsoft.demon.co.uk/code/index.html

Neil may be back in a minute to give very precise instructions as to how you
can get xp_sendmail to work via SMTP, but in my experience any configuration
is flaky at best (eventually it'll hang).
It's also possible to use xp_sendmail via NT's PostOffice, but generally
that's utterly useless 'cos noone uses it.

Which leaves sending SMTP via some other method.

You can do it via COM (indeed, the code that is used in my SMTP xp was
originally in a COM object), but controlling COM objects via SQL is ugly,
error prone (i.e. the error handling facilities are minimal) and hard to
maintain.
So I rewrote my COM object as an XP.

If you wait until later today I should be uploading a newer version.

J.T.

 
 
 

new record, mail to someone

Post by Tibor Karasz » Thu, 19 Aug 1999 04:00:00


xp_sendmail does _not_ require exchange.

It requires the MAPI api on the SQL Server machine. This is installed with a
number of mail clients (outlook, for instance). Thos mail clients generally
have drivers (providers) for a _number_ of mail servers, including SMTP.

--
Tibor Karaszi
MCDBA, MCSE, MCSD, MCT, SQL Server MVP
Cornerstone Sweden AB
Please reply to the newsgroup only, not by email.


> xp_sendmail will require ms exchange, and also a profile set up on the
> machine, right?

> SMTP is simpler.  how would you do it using SMTP, apart from using a
> com object?



> > JT - nope, just a typo.  xp_sendmail would be the thing!

> > > Surely xp_sendmail would be more use if he wants to send mail, or
> are you
> > > hiding a secret somewhere?

> >  Neil Pike MVP/MCSE.  Protech Computing Ltd
> >  (Please reply only to newsgroups)
> >  For SQL FAQ entries see

> >  or www.ntfaq.com/sql.html (+ ntfaq download)
> >  or http://www.swynk.com/faq/sql/sqlserverfaq.asp
> >  or http://www.sql-server.co.uk

> Sent via Deja.com http://www.deja.com/
> Share what you know. Learn what you don't.