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:
-
For SQL Server 7.0 download XPSMTP70.ZIP and unzip the files
For SQL Server 2000, download XPSMTP80.ZIP and unzip the files -
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” -
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’
-
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:
-
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
-
Unregistered the XP from the system, using OSQL or SQL Query Analyzer by executing:
exec sp_dropextendedproc ‘xp_smtp_sendmail’
-
Delete the XPSMTP70.DLL or XPSMTP80.DLL from the SQL Server BINN directory
es muy bueno para el entorno de outlook me gustaria si hay script con sql para mozilla
Como se podria hacer para usarlo con Lotus Notes?