Machetes Varios

apuntes varios erp cwa logic ( ahora SoftLand Logic ) – sql y veremos que otra cosa

Envío de mails desde el SQL Server


No necesita tener instalado outlook. Simplemente se envía el mail desde un stored procedure extendido. No necesita más instalación que la de copiar una dll al servidor.

Gracias a Rafa por el dato

El link aqui

The procedure returns only two return codes, 0 (zero) indicating successful execution, 1 indicating failure always accompanied with an error message.

 

This is how to retrieve the return code:

 

declare @rc int

exec @rc = master.dbo.xp_smtp_sendmail …

select @rc

Installation:


To install XPSMTP follow these instructions:

  1. For SQL Server 7.0 download XPSMTP70.ZIP and unzip the files
    For SQL Server 2000, download XPSMTP80.ZIP and unzip the files

  2. Copy xpsmtpXX.dll into the SQL Server BINN directory. For SQL Server 7.0 copy XPSMTP70.DLL, for SQL Server 2000 copy XPSMTP80.DLL

    For SQL Server 7.0 the default installation location is “C:\MSSQL7\BINN”
    For SQL Server 2000 the default location is “C:\Program Files\Microsoft SQL Server\MSSQL\Binn”

  3. Register the extended stored procedure using OSQL or SQL Query Analyzer by executing:
    – SQL Server 7.0 install
    exec sp_addextendedproc ‘xp_smtp_sendmail’, ‘xpsmtp70.dll’
    – SQL Server 2000 install
    exec sp_addextendedproc ‘xp_smtp_sendmail’, ‘xpsmtp80.dll’

  4. Grant rights to the correct set of users using OSQL or SQL Query Analyzer by executing:
    grant execute on xp_smtp_sendmail to public
    By default only the member of the sysadmin role have execution rights on the XP after it is being registered

Uninstall:


To remove XPSMTP from a system follow these instructions:

  1. Force the DLL out of memory, using OSQL or SQL Query Analyzer by executing:
    dbcc xpsmtp70(free) — for SQL Server 7.0
    dbcc xpsmtp80(free) — for SQL Server 2000

  2. Unregistered the XP from the system, using OSQL or SQL Query Analyzer by executing:
    exec sp_dropextendedproc ‘xp_smtp_sendmail’

  3. Delete the XPSMTP70.DLL or XPSMTP80.DLL from the SQL Server BINN directory

septiembre 11, 2006 - Publicado por | 1.9 Penta Consulting, Software, sql magazine, Transact SQL

2 comentarios »

  1. es muy bueno para el entorno de outlook me gustaria si hay script con sql para mozilla

    Comentario por marco | noviembre 7, 2007 | Responder

  2. Como se podria hacer para usarlo con Lotus Notes?

    Comentario por eloisa | abril 7, 2008 | Responder


Deja un comentario

Fill in your details below or click an icon to log in:

Logo de WordPress.com

You are commenting using your WordPress.com account. Log Out / Cambiar )

Twitter picture

You are commenting using your Twitter account. Log Out / Cambiar )

Facebook photo

You are commenting using your Facebook account. Log Out / Cambiar )

Connecting to %s

Seguir

Get every new post delivered to your Inbox.