Twitter iPhone pliant OnePlus 11 PS5 Disney+ Orange Livebox Windows 11

Client MAPI pour sqlmail

15 réponses
Avatar
jack
Bonjour,

Configuration : Windows 2000 server SP4 et SQL2000 SP4

J'ai besoin d'installer un client MAPI pour créer un profil utilisable par
sqlmail afin d'utliser master.dbo.xp_sendmail

Est-il possible d'installer quelque chose de moins "lourd" que Outlook ?
Et si oui quoi et comment créer le profil ?

Merci

10 réponses

1 2
Avatar
hch
Non il faut outlook et c'est la tout le probleme

SQL2005 fournit une solution Database Mail basée sur SMTP et ne necessitant
aucune install de client messagerie

hch

"jack" wrote:

Bonjour,

Configuration : Windows 2000 server SP4 et SQL2000 SP4

J'ai besoin d'installer un client MAPI pour créer un profil utilisable par
sqlmail afin d'utliser master.dbo.xp_sendmail

Est-il possible d'installer quelque chose de moins "lourd" que Outlook ?
Et si oui quoi et comment créer le profil ?

Merci





Avatar
jack
Merci,

Je vais me préparer à redémarrer encore et encore...

"hch" wrote in message
news:
Non il faut outlook et c'est la tout le probleme

SQL2005 fournit une solution Database Mail basée sur SMTP et ne


necessitant
aucune install de client messagerie

hch

"jack" wrote:

> Bonjour,
>
> Configuration : Windows 2000 server SP4 et SQL2000 SP4
>
> J'ai besoin d'installer un client MAPI pour créer un profil utilisable


par
> sqlmail afin d'utliser master.dbo.xp_sendmail
>
> Est-il possible d'installer quelque chose de moins "lourd" que Outlook ?
> Et si oui quoi et comment créer le profil ?
>
> Merci
>
>
>


Avatar
Daniel Eyer
Il est possible avec SQL 2000, d'envoyer des mail sans utiliser xp_sendmail.
Ci-dessous une procédure que j'utilise avec succès.
Aucun client de messagerie n'est requis.
http://support.microsoft.com/kb/312839
Daniel

CREATE PROCEDURE [dbo].[sp_send_cdosysmail]
@From varchar(100) ,
@To varchar(100) ,
@Subject varchar(100)=" ",
@Body varchar(4000) =" "
/*********************************************************************

This stored procedure takes the above parameters and sends an e-mail.
All of the mail configurations are hard-coded in the stored procedure.
Comments are added to the stored procedure where necessary.
Reference to the CDOSYS objects are at the following MSDN Web site:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cdosys/html/_cdosys_messaging.asp

***********************************************************************/
AS
Declare @iMsg int
Declare @hr int
Declare @source varchar(255)
Declare @description varchar(500)
Declare @output varchar(1000)

--************* Create the CDO.Message Object ************************
EXEC @hr = sp_OACreate 'CDO.Message', @iMsg OUT

--***************Configuring the Message Object ******************
-- This is to configure a remote SMTP server.
--
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cdosys/html/_cdosys_schema_configuration_sendusing.asp
EXEC @hr = sp_OASetProperty @iMsg,
'Configuration.fields("http://schemas.microsoft.com/cdo/configuration/sendusing").Value','2'
-- This is to configure the Server Name or IP address.
-- Replace MailServerName by the name or IP of your SMTP Server.
EXEC @hr = sp_OASetProperty @iMsg,
'Configuration.fields("http://schemas.microsoft.com/cdo/configuration/smtpserver").Value',
'MailServerName'

-- Save the configurations to the message object.
EXEC @hr = sp_OAMethod @iMsg, 'Configuration.Fields.Update', null

-- Set the e-mail parameters.
EXEC @hr = sp_OASetProperty @iMsg, 'To', @To
EXEC @hr = sp_OASetProperty @iMsg, 'From', @From
EXEC @hr = sp_OASetProperty @iMsg, 'Subject', @Subject

-- If you are using HTML e-mail, use 'HTMLBody' instead of 'TextBody'.
EXEC @hr = sp_OASetProperty @iMsg, 'TextBody', @Body
EXEC @hr = sp_OAMethod @iMsg, 'Send', NULL

-- Sample error handling.
IF @hr <>0
select @hr
BEGIN
EXEC @hr = sp_OAGetErrorInfo NULL, @source OUT, @description OUT
IF @hr = 0
BEGIN
SELECT @output = ' Source: ' + @source
PRINT @output
SELECT @output = ' Description: ' + @description
PRINT @output
END
ELSE
BEGIN
PRINT ' sp_OAGetErrorInfo failed.'
RETURN
END
END

-- Do some error handling after each step if you need to.
-- Clean up the objects created.
EXEC @hr = sp_OADestroy @iMsg
go
Ensuite, utilisez la procédure stockée que vous avez créée et fournissez les
paramètres corrects :
declare @Body varchar(4000)
select @Body = 'This is a Test Message'
exec sp_send_cdosysmail
'','','Test of CDOSYS',@Body

"jack" a écrit dans le message de news:
%
Bonjour,

Configuration : Windows 2000 server SP4 et SQL2000 SP4

J'ai besoin d'installer un client MAPI pour créer un profil utilisable par
sqlmail afin d'utliser master.dbo.xp_sendmail

Est-il possible d'installer quelque chose de moins "lourd" que Outlook ?
Et si oui quoi et comment créer le profil ?

Merci




Avatar
jack
Merci.

Et j'imagine que si l'on a des pièces jointes il faut ajouter cela

EXEC @hr = sp_OAMethod @object, 'AddAttachment', NULL, 'c:myfile.txt'





"Daniel Eyer" wrote in message
news:484f89e2$0$864$
Il est possible avec SQL 2000, d'envoyer des mail sans utiliser


xp_sendmail.
Ci-dessous une procédure que j'utilise avec succès.
Aucun client de messagerie n'est requis.
http://support.microsoft.com/kb/312839
Daniel

CREATE PROCEDURE [dbo].[sp_send_cdosysmail]
@From varchar(100) ,
@To varchar(100) ,
@Subject varchar(100)=" ",
@Body varchar(4000) =" "
/*********************************************************************

This stored procedure takes the above parameters and sends an e-mail.
All of the mail configurations are hard-coded in the stored procedure.
Comments are added to the stored procedure where necessary.
Reference to the CDOSYS objects are at the following MSDN Web site:



http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cdosys/html/_cdosys_messaging.asp

***********************************************************************/
AS
Declare @iMsg int
Declare @hr int
Declare @source varchar(255)
Declare @description varchar(500)
Declare @output varchar(1000)

--************* Create the CDO.Message Object ************************
EXEC @hr = sp_OACreate 'CDO.Message', @iMsg OUT

--***************Configuring the Message Object ******************
-- This is to configure a remote SMTP server.
--



http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cdosys/html/_cdosys_schema_configuration_sendusing.asp
EXEC @hr = sp_OASetProperty @iMsg,



'Configuration.fields("http://schemas.microsoft.com/cdo/configuration/sendus
ing").Value','2'
-- This is to configure the Server Name or IP address.
-- Replace MailServerName by the name or IP of your SMTP Server.
EXEC @hr = sp_OASetProperty @iMsg,



'Configuration.fields("http://schemas.microsoft.com/cdo/configuration/smtpse
rver").Value',
'MailServerName'

-- Save the configurations to the message object.
EXEC @hr = sp_OAMethod @iMsg, 'Configuration.Fields.Update', null

-- Set the e-mail parameters.
EXEC @hr = sp_OASetProperty @iMsg, 'To', @To
EXEC @hr = sp_OASetProperty @iMsg, 'From', @From
EXEC @hr = sp_OASetProperty @iMsg, 'Subject', @Subject

-- If you are using HTML e-mail, use 'HTMLBody' instead of 'TextBody'.
EXEC @hr = sp_OASetProperty @iMsg, 'TextBody', @Body
EXEC @hr = sp_OAMethod @iMsg, 'Send', NULL

-- Sample error handling.
IF @hr <>0
select @hr
BEGIN
EXEC @hr = sp_OAGetErrorInfo NULL, @source OUT, @description OUT
IF @hr = 0
BEGIN
SELECT @output = ' Source: ' + @source
PRINT @output
SELECT @output = ' Description: ' + @description
PRINT @output
END
ELSE
BEGIN
PRINT ' sp_OAGetErrorInfo failed.'
RETURN
END
END

-- Do some error handling after each step if you need to.
-- Clean up the objects created.
EXEC @hr = sp_OADestroy @iMsg
go
Ensuite, utilisez la procédure stockée que vous avez créée et fournissez


les
paramètres corrects :
declare @Body varchar(4000)
select @Body = 'This is a Test Message'
exec sp_send_cdosysmail
'','','Test of CDOSYS',@Body

"jack" a écrit dans le message de news:
%
> Bonjour,
>
> Configuration : Windows 2000 server SP4 et SQL2000 SP4
>
> J'ai besoin d'installer un client MAPI pour créer un profil utilisable


par
> sqlmail afin d'utliser master.dbo.xp_sendmail
>
> Est-il possible d'installer quelque chose de moins "lourd" que Outlook ?
> Et si oui quoi et comment créer le profil ?
>
> Merci
>
>




Avatar
Daniel Eyer
C'est tout à fait ça.

Je me suis crée une procédure qui permet d'envoyer le résultat d'une requète
au format HTML. (cf ci-dessous)

Quelques limitations
- le résultat de la requète ne peut exéder 8000 caractères
- les colonnes doivent être au format texte. Pour les dates et nombre, il
suffit d'utiliser les fonctions de convertion.

Daniel Eyer

-----------------------------------------------------------------
Create PROCEDURE [dbo].[sp_send_MailHtml]
@From varchar(128) ,
@To varchar(128) ,
@Cc varchar(128) ,
@BCc varchar(128) ,
@Subject varchar(124)=" ",
@Query varchar(4000) = " "
/*********************************************************************

This stored procedure takes the above parameters and sends an e-mail.
All of the mail configurations are hard-coded in the stored procedure.
Comments are added to the stored procedure where necessary.
Reference to the CDOSYS objects are at the following MSDN Web site:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cdosys/html/_cdosys_messaging.asp" target="_blank" class="text-blue hover:opacity-90 " style="word-break: break-all;" rel="noopener nofollow">http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cdosys/html/_cdosys_messaging.asp

***********************************************************************/
AS

--Mail declaration
Declare @iMsg int
Declare @hr int
Declare @source varchar(255)
Declare @description varchar(500)
Declare @output varchar(1000)

--HTML declaration
declare @Columns varchar(8000)
declare @ColHeader varchar(8000)
Declare @SqlCmd varchar(8000)
Declare @HTMLBody varchar(8000)

--************* Create the CDO.Message Object ************************
EXEC @hr = sp_OACreate 'CDO.Message', @iMsg OUT

--***************Configuring the Message Object ******************
-- This is to configure a remote SMTP server.
--
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cdosys/html/_cdosys_schema_configuration_sendusing.asp" target="_blank" class="text-blue hover:opacity-90 " style="word-break: break-all;" rel="noopener nofollow">http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cdosys/html/_cdosys_schema_configuration_sendusing.asp
EXEC @hr = sp_OASetProperty @iMsg,
'Configuration.fields("http://schemas.microsoft.com/cdo/configuration/sendusing&quot" target="_blank" class="text-blue hover:opacity-90 " style="word-break: break-all;" rel="noopener nofollow">http://schemas.microsoft.com/cdo/configuration/sendusing&quot;).Value','2'
-- This is to configure the Server Name or IP address.
-- Replace MailServerName by the name or IP of your SMTP Server.
EXEC @hr = sp_OASetProperty @iMsg,
'Configuration.fields("http://schemas.microsoft.com/cdo/configuration/smtpserver&quot" target="_blank" class="text-blue hover:opacity-90 " style="word-break: break-all;" rel="noopener nofollow">http://schemas.microsoft.com/cdo/configuration/smtpserver&quot;).Value',
'smtp.fr.oleane.com'

-- Save the configurations to the message object.
EXEC @hr = sp_OAMethod @iMsg, 'Configuration.Fields.Update', null

-- Set the e-mail parameters.
EXEC @hr = sp_OASetProperty @iMsg, 'To', @To
EXEC @hr = sp_OASetProperty @iMsg, 'From', @From
If(@Cc Is Not Null)
Exec @hr = sp_OASetProperty @iMsg, 'Cc', @Cc
If(@BCc Is Not Null)
Exec @hr = sp_OASetProperty @iMsg, 'BCc', @BCc
EXEC @hr = sp_OASetProperty @iMsg, 'Subject', @Subject

-- If you are using HTML e-mail, use 'HTMLBody' instead of 'TextBody'.
-- EXEC @hr = sp_OASetProperty @iMsg, 'HTMLBody', @Body

/*************************************************************************/

-- drop temporary tables used.
IF EXISTS (SELECT * FROM tempdb.dbo.sysobjects WHERE name = '##TEMPhtml1')
DROP TABLE ##TEMPhtml1

IF EXISTS (SELECT * FROM tempdb.dbo.sysobjects WHERE name = '##TEMPhtml2')
DROP TABLE ##TEMPhtml2

-- prepare query
set @SqlCmd = 'select * into ##tempHTML1 from (' + @Query + ') as t1'
execute (@SqlCmd)

--Prepare columns details
SELECT @columns COALESCE(@columns + ' + ''</td><td>'' + ', '') +
'RTrim(convert(varchar(100),isnull(' + column_name +','' '')))'
FROM tempdb.information_schema.columns
where table_name='##tempHTML1'

--Prepare column Header
set @colHeader = '<tr bgcolor=#EDFEDF align=Left>'
SELECT @colHeader = @colHeader + '<td><b>' + column_name + '</b></td>'
FROM tempdb.information_schema.columns where table_name='##tempHTML1'
set @colHeader=@colHeader + '</tr>'

--prepare final output
set @SqlCmd 'Select ''<tr><td>'' + ' +
@columns +
' ''</td></tr> '' into ##tempHTML2 from ##tempHTML1 '
execute( @SqlCmd)

-- set @finalhtmlout set @HtmlBody ' <html> <body><style type="text/css" media="all"> ' +
'table { margin-bottom: 2em; border-collapse: collapse } ' +
'td,th {border= 1 solid #999; padding: 0.2em 0.2em; font-size: 12;} ' +
'</style> <table width="100%"> ' +
@colHeader

select @HtmlBody = @HtmlBody + [</td></tr>]
from ##tempHTML2

set @HtmlBody = @HtmlBody + ' </table></body></htmL>'

EXEC @hr = sp_OASetProperty @iMsg, 'HTMLBody', @HtmlBody
EXEC @hr = sp_OAMethod @iMsg, 'Send', NULL

-- drop temporary tables used.
IF EXISTS (SELECT * FROM tempdb.dbo.sysobjects WHERE name = '##TEMPhtml1')
DROP TABLE ##TEMPhtml1

IF EXISTS (SELECT * FROM tempdb.dbo.sysobjects WHERE name = '##TEMPhtml2')
DROP TABLE ##TEMPhtml2


/*************************************************************************/

-- Sample error handling.
/* IF @hr <>0
select @hr
BEGIN
EXEC @hr = sp_OAGetErrorInfo NULL, @source OUT, @description OUT
IF @hr = 0
BEGIN
SELECT @output = ' Source: ' + @source
PRINT @output
SELECT @output = ' Description: ' + @description
PRINT @output
END
ELSE
BEGIN
PRINT ' sp_OAGetErrorInfo failed.'
RETURN
END
END
*/
-- Do some error handling after each step if you need to.
-- Clean up the objects created.
EXEC @hr = sp_OADestroy @iMsg


GO
SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS ON
GO





-----------------------------------------------------------------




"jack" a écrit dans le message de news:

Merci.

Et j'imagine que si l'on a des pièces jointes il faut ajouter cela

EXEC @hr = sp_OAMethod @object, 'AddAttachment', NULL, 'c:myfile.txt'





"Daniel Eyer" wrote in message
news:484f89e2$0$864$
Il est possible avec SQL 2000, d'envoyer des mail sans utiliser


xp_sendmail.
Ci-dessous une procédure que j'utilise avec succès.
Aucun client de messagerie n'est requis.
http://support.microsoft.com/kb/312839
Daniel

CREATE PROCEDURE [dbo].[sp_send_cdosysmail]
@From varchar(100) ,
@To varchar(100) ,
@Subject varchar(100)=" ",
@Body varchar(4000) =" "
/*********************************************************************

This stored procedure takes the above parameters and sends an e-mail.
All of the mail configurations are hard-coded in the stored procedure.
Comments are added to the stored procedure where necessary.
Reference to the CDOSYS objects are at the following MSDN Web site:



http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cdosys/html/_cdosys_messaging.asp" target="_blank" class="text-blue hover:opacity-90 " style="word-break: break-all;" rel="noopener nofollow">http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cdosys/html/_cdosys_messaging.asp

***********************************************************************/
AS
Declare @iMsg int
Declare @hr int
Declare @source varchar(255)
Declare @description varchar(500)
Declare @output varchar(1000)

--************* Create the CDO.Message Object ************************
EXEC @hr = sp_OACreate 'CDO.Message', @iMsg OUT

--***************Configuring the Message Object ******************
-- This is to configure a remote SMTP server.
--



http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cdosys/html/_cdosys_schema_configuration_sendusing.asp" target="_blank" class="text-blue hover:opacity-90 " style="word-break: break-all;" rel="noopener nofollow">http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cdosys/html/_cdosys_schema_configuration_sendusing.asp
EXEC @hr = sp_OASetProperty @iMsg,



'Configuration.fields("http://schemas.microsoft.com/cdo/configuration/sendus
ing").Value','2'
-- This is to configure the Server Name or IP address.
-- Replace MailServerName by the name or IP of your SMTP Server.
EXEC @hr = sp_OASetProperty @iMsg,



'Configuration.fields("http://schemas.microsoft.com/cdo/configuration/smtpse
rver").Value',
'MailServerName'

-- Save the configurations to the message object.
EXEC @hr = sp_OAMethod @iMsg, 'Configuration.Fields.Update', null

-- Set the e-mail parameters.
EXEC @hr = sp_OASetProperty @iMsg, 'To', @To
EXEC @hr = sp_OASetProperty @iMsg, 'From', @From
EXEC @hr = sp_OASetProperty @iMsg, 'Subject', @Subject

-- If you are using HTML e-mail, use 'HTMLBody' instead of 'TextBody'.
EXEC @hr = sp_OASetProperty @iMsg, 'TextBody', @Body
EXEC @hr = sp_OAMethod @iMsg, 'Send', NULL

-- Sample error handling.
IF @hr <>0
select @hr
BEGIN
EXEC @hr = sp_OAGetErrorInfo NULL, @source OUT, @description OUT
IF @hr = 0
BEGIN
SELECT @output = ' Source: ' + @source
PRINT @output
SELECT @output = ' Description: ' + @description
PRINT @output
END
ELSE
BEGIN
PRINT ' sp_OAGetErrorInfo failed.'
RETURN
END
END

-- Do some error handling after each step if you need to.
-- Clean up the objects created.
EXEC @hr = sp_OADestroy @iMsg
go
Ensuite, utilisez la procédure stockée que vous avez créée et fournissez


les
paramètres corrects :
declare @Body varchar(4000)
select @Body = 'This is a Test Message'
exec sp_send_cdosysmail
'','','Test of CDOSYS',@Body

"jack" a écrit dans le message de news:
%
> Bonjour,
>
> Configuration : Windows 2000 server SP4 et SQL2000 SP4
>
> J'ai besoin d'installer un client MAPI pour créer un profil utilisable


par
> sqlmail afin d'utliser master.dbo.xp_sendmail
>
> Est-il possible d'installer quelque chose de moins "lourd" que Outlook
> ?
> Et si oui quoi et comment créer le profil ?
>
> Merci
>
>








Avatar
SQLpro
Ma collègue Catherine Brunie et moi même avons mis au point différent
scripts en utilisant CDOsys pour ce faire :
Lisez les sur Guss.fr :
http://www.guss.fr/Accueil/Espacemembres/Touslesarticles/tabid/70/articleTyp e/ArticleView/articleId/18/Default.aspx

A +

On 11 juin, 12:43, "Daniel Eyer" wrote:
C'est tout à fait ça.

Je me suis crée une procédure qui permet d'envoyer le résultat d'une requète
au format HTML. (cf ci-dessous)

Quelques limitations
- le résultat de la requète ne peut exéder 8000 caractères
- les colonnes doivent être au format texte. Pour les dates et nombre, i l
suffit d'utiliser les fonctions de convertion.

Daniel Eyer

-----------------------------------------------------------------
Create PROCEDURE [dbo].[sp_send_MailHtml]
@From varchar(128) ,
@To varchar(128) ,
@Cc varchar(128) ,
@BCc varchar(128) ,
@Subject varchar(124)=" ",
@Query varchar(4000) = " "
/*********************************************************************

This stored procedure takes the above parameters and sends an e-mail.
All of the mail configurations are hard-coded in the stored procedure.
Comments are added to the stored procedure where necessary.
Reference to the CDOSYS objects are at the following MSDN Web site:http:// msdn.microsoft.com/library/default.asp?url=/library/en-us/cdos...

***********************************************************************/
AS

--Mail declaration
Declare @iMsg int
Declare @hr int
Declare @source varchar(255)
Declare @description varchar(500)
Declare @output varchar(1000)

--HTML declaration
declare @Columns varchar(8000)
declare @ColHeader varchar(8000)
Declare @SqlCmd varchar(8000)
Declare @HTMLBody varchar(8000)

--************* Create the CDO.Message Object ************************
EXEC @hr = sp_OACreate 'CDO.Message', @iMsg OUT

--***************Configuring the Message Object ******************
-- This is to configure a remote SMTP server.
-- http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cdo s...
EXEC @hr = sp_OASetProperty @iMsg,
'Configuration.fields("http://schemas.microsoft.com/cdo/configuration/send" target="_blank" class="text-blue hover:opacity-90 " style="word-break: break-all;" rel="noopener nofollow">http://schemas.microsoft.com/cdo/configuration/send using").Value','2'
-- This is to configure the Server Name or IP address.
-- Replace MailServerName by the name or IP of your SMTP Server.
EXEC @hr = sp_OASetProperty @iMsg,
'Configuration.fields("http://schemas.microsoft.com/cdo/configuration/smtp" target="_blank" class="text-blue hover:opacity-90 " style="word-break: break-all;" rel="noopener nofollow">http://schemas.microsoft.com/cdo/configuration/smtp server").Value',
'smtp.fr.oleane.com'

-- Save the configurations to the message object.
EXEC @hr = sp_OAMethod @iMsg, 'Configuration.Fields.Update', null

-- Set the e-mail parameters.
EXEC @hr = sp_OASetProperty @iMsg, 'To', @To
EXEC @hr = sp_OASetProperty @iMsg, 'From', @From
If(@Cc Is Not Null)
Exec @hr = sp_OASetProperty @iMsg, 'Cc', @Cc
If(@BCc Is Not Null)
Exec @hr = sp_OASetProperty @iMsg, 'BCc', @BCc
EXEC @hr = sp_OASetProperty @iMsg, 'Subject', @Subject

-- If you are using HTML e-mail, use 'HTMLBody' instead of 'TextBody'.
-- EXEC @hr = sp_OASetProperty @iMsg, 'HTMLBody', @Body

/************************************************************************* /

-- drop temporary tables used.
IF EXISTS (SELECT * FROM tempdb.dbo.sysobjects WHERE name = '##TEMPhtm l1')
DROP TABLE ##TEMPhtml1

IF EXISTS (SELECT * FROM tempdb.dbo.sysobjects WHERE name = '##TEMPhtm l2')
DROP TABLE ##TEMPhtml2

-- prepare query
set @SqlCmd = 'select * into ##tempHTML1 from (' + @Query + ') as t1'
execute (@SqlCmd)

--Prepare columns details
SELECT @columns =
COALESCE(@columns + ' + ''</td><td>'' + ', '') +
'RTrim(convert(varchar(100),isnull(' + column_name +','' '')))'
FROM tempdb.information_schema.columns
where table_name='##tempHTML1'

--Prepare column Header
set @colHeader = '<tr bgcolor=#EDFEDF align=Left>'
SELECT @colHeader = @colHeader + '<td><b>' + column_name + '</b></td>'
FROM tempdb.information_schema.columns where table_name='##tempHTML1'
set @colHeader=@colHeader + '</tr>'

--prepare final output
set @SqlCmd =
'Select ''<tr><td>'' + ' +
@columns +
' ''</td></tr> '' into ##tempHTML2 from ##tempHTML1 '
execute( @SqlCmd)

-- set @finalhtmlout=
set @HtmlBody =
' <html> <body><style type="text/css" media="all"> ' +
'table { margin-bottom: 2em; border-collapse: collapse } ' +
'td,th {border= 1 solid #999; padding: 0.2em 0.2em; font-size: 12;} ' +
'</style> <table width="100%"> ' +
@colHeader

select @HtmlBody = @HtmlBody + [</td></tr>]
from ##tempHTML2

set @HtmlBody = @HtmlBody + ' </table></body></htmL>'

EXEC @hr = sp_OASetProperty @iMsg, 'HTMLBody', @HtmlBody
EXEC @hr = sp_OAMethod @iMsg, 'Send', NULL

-- drop temporary tables used.
IF EXISTS (SELECT * FROM tempdb.dbo.sysobjects WHERE name = '##TEMPhtm l1')
DROP TABLE ##TEMPhtml1

IF EXISTS (SELECT * FROM tempdb.dbo.sysobjects WHERE name = '##TEMPhtm l2')
DROP TABLE ##TEMPhtml2

/************************************************************************* /

-- Sample error handling.
/* IF @hr <>0
select @hr
BEGIN
EXEC @hr = sp_OAGetErrorInfo NULL, @source OUT, @description OUT
IF @hr = 0
BEGIN
SELECT @output = ' Source: ' + @source
PRINT @output
SELECT @output = ' Description: ' + @description
PRINT @output
END
ELSE
BEGIN
PRINT ' sp_OAGetErrorInfo failed.'
RETURN
END
END
*/
-- Do some error handling after each step if you need to.
-- Clean up the objects created.
EXEC @hr = sp_OADestroy @iMsg

GO
SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS ON
GO

-----------------------------------------------------------------

"jack" a écrit dans le message de news:


> Merci.

> Et j'imagine que si l'on a des pièces jointes il faut ajouter cela

> EXEC @hr = sp_OAMethod @object, 'AddAttachment', NULL, 'c:myfile.txt'

> "Daniel Eyer" wrote in message
>news:484f89e2$0$864$
>> Il est possible avec SQL 2000, d'envoyer des mail sans utiliser
> xp_sendmail.
>> Ci-dessous une procédure que j'utilise avec succès.
>> Aucun client de messagerie n'est requis.
>>http://support.microsoft.com/kb/312839
>> Daniel

>> CREATE PROCEDURE [dbo].[sp_send_cdosysmail]
>> @From varchar(100) ,
>> @To varchar(100) ,
>> @Subject varchar(100)=" ",
>> @Body varchar(4000) =" "
>> /*********************************************************************

>> This stored procedure takes the above parameters and sends an e-mail.
>> All of the mail configurations are hard-coded in the stored procedure.
>> Comments are added to the stored procedure where necessary.
>> Reference to the CDOSYS objects are at the following MSDN Web site:

>http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cdos.. .

>> *********************************************************************** /
>> AS
>> Declare @iMsg int
>> Declare @hr int
>> Declare @source varchar(255)
>> Declare @description varchar(500)
>> Declare @output varchar(1000)

>> --************* Create the CDO.Message Object ************************
>> EXEC @hr = sp_OACreate 'CDO.Message', @iMsg OUT

>> --***************Configuring the Message Object ******************
>> -- This is to configure a remote SMTP server.
>> --

>http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cdos.. .
>> EXEC @hr = sp_OASetProperty @iMsg,

> 'Configuration.fields("http://schemas.microsoft.com/cdo/configuration/se ndus
> ing").Value','2'
>> -- This is to configure the Server Name or IP address.
>> -- Replace MailServerName by the name or IP of your SMTP Server.
>> EXEC @hr = sp_OASetProperty @iMsg,

> 'Configuration.fields("http://schemas.microsoft.com/cdo/configuration/sm tpse
> rver").Value',
>> 'MailServerName'

>> -- Save the configurations to the message object.
>> EXEC @hr = sp_OAMethod @iMsg, 'Configuration.Fields.Update', null

>> -- Set the e-mail parameters.
>> EXEC @hr = sp_OASetProperty @iMsg, 'To', @To
>> EXEC @hr = sp_OASetProperty @iMsg, 'From', @From
>> EXEC @hr = sp_OASetProperty @iMsg, 'Subject', @Subject

>> -- If you are using HTML e-mail, use 'HTMLBody' instead of 'TextBody'.
>> EXEC @hr = sp_OASetProperty @iMsg, 'TextBody', @Body
>> EXEC @hr = sp_OAMethod @iMsg, 'Send', NULL

>> -- Sample error handling.
>> IF @hr <>0
>> select @hr
>> BEGIN
>> EXEC @hr = sp_OAGetErrorInfo NULL, @source OUT, @description O UT
>> IF @hr = 0
>> BEGIN
>> SELECT @output = ' Source: ' + @source
>> PRINT @output
>> SELECT @output = ' Description: ' + @description
>> PRINT @output
>> END
>> ELSE
>> BEGIN
>> PRINT ' sp_OAGetErrorInfo failed.'
>> RETURN
>> END
>> END

>> -- Do some error handling after each step if you need to.
>> -- Clean up the objects created.
>> EXEC @hr = sp_OADestroy @iMsg
>> go
>> Ensuite, utilisez la procédure stockée que vous avez créée et f ournissez
> les
>> paramètres corrects :
>> declare @Body varchar(4000)
>> select @Body = 'This is a Test Message'
>> exec sp_send_cdosysmail
>> '','','Test of CDOSYS',@Body

>> "jack" a écrit dans le message de news:
>> %
>> > Bonjour,

>> > Configuration : Windows 2000 server SP4 et SQL2000 SP4

>> > J'ai besoin d'installer un client MAPI pour créer un profil utilisa ble
> par
>> > sqlmail afin d'utliser master.dbo.xp_sendmail

>> > Est-il possible d'installer quelque chose de moins "lourd" que Outloo k
>> > ?
>> > Et si oui quoi et comment créer le profil ?

>> > Merci


Avatar
helios services
SQLpro a écrit :
Ma collègue Catherine Brunie et moi même avons mis au point différent
scripts en utilisant CDOsys pour ce faire :
Lisez les sur Guss.fr :
http://www.guss.fr/Accueil/Espacemembres/Touslesarticles/tabid/70/articleType/ArticleView/articleId/18/Default.aspx

A +





est ce que Catherine Brunie est blonde d'origine ? car vue que son
collègue prétend coder plus de 65536 valeurs sur 2 octets il y a des
questions à se poser :-)

http://groups.google.com/group/fr.comp.applications.sgbd/msg/621527f995585842?dmode=source


--
Dr Thierry HOLZ
HELIOS SERVICES
180 rue de la croix du chene
60250 HEILLES
www.openqm.com02.net
www.pick.com02.net
Avatar
llopht
> Si vous ne démentez pas immédiatement les affirmations de "incompétent"
ou ne les prouver pas je vais peut être suivre l'exemple de Brouard et
vous demander 20000 euro pour diffamation à l'encontre de ma personne et
ma société puisque cosignataires des messages alors fournissez vos
preuves ou excuser vous . Quand aux niveaux de compétence de Fred il
n'est plus à démontrer puisque il est de notoriété publique dans les
milieux compétents .



Je suis pas juge mais en reprenant votre profil et en allant voir vos
messages c'est tout de même affligeant le nombre de personnes qui sont
pour vous incompétents donc à mon avis subir un simple retour de bâton
ne vaut pas l'intérêt de sortir tout de suite l'armada des procédures.
D'ailleurs c'est tout de même dommage pour un docteur de reprocher aux
autres ce que l'on est pas capable de mettre soit même en application,
dans le même texte vous passez tout de même de la défense à l'attaque...

Quand aux différents reproches qui sont faits à Fred Brouard, je trouve
que c'est tout de même facile... Il est incompétent, soit, alors montrer
que vous êtes meilleur, écrivez un bouquin, investissez vous dans divers
communauté tel quel developpez.com, animé un forum sur les SGBD, devenez
MVP (sur les SGBD Microsoft, si ce n'est pas le cas) mais arrêtez de le
ressasser à chaque mail qu'il écrit ça devient du harcèlement, ça doit
être lassant pour lui et pour les autres utilisateurs. Et surtout ça
vous dessert complètement, avant aujourd'hui, je n'étais même pas au
courant de votre existence... Google est un outils génial il permet
d'obtenir tout sur votre vie, vos discussions sur wiki, sur les forums,
ce qui permet de se faire rapidement un avis...

J'ai vu pas mal de reproche que Fred faisait ça pub. Pour son livre,
c'est certain mais est-ce un mal ? Quoi de plus génial de pouvoir lire
ce genre d'ouvrage et de pouvoir discuter avec l'auteur...
Personnellement j'ai des centaines de livres et je ne connais que deux
auteurs avec lequel c'est possible, Fred est l'un deux. Et ça pub n'a
pas encore fonctionné sur moi, je n'ai pas sous bouquin ! Mis à part ça,
je suis incapable de citer le nom de son entreprise, à l'inverse de la
votre... donc au niveau pub tout est relatif.

Donc encore une fois, je ne suis pas juge, mais la meilleure façon de ne
pas trouver n'est elle pas de ne pas chercher ?

J'ai vraiment du mal à comprendre ce genre de réaction...

Jérôme
Avatar
llopht
Une dent contre F.Brouard ?

Il a à toujours aidé et conseillé les débutants comme moi à s'en sortir
avec du SQL. Il a au moins le mérite d'aider... et personellement je
l'en remercie !!!

D'ailleurs ça parle tout seul...

http://groups.google.com/groups/profile?enc_user=KTU1kBkAAADfn7A4od9Z9XUrjwUviHWh1d3Bh14JbBF4X2XPMNCJJg

Vous...

http://groups.google.com/groups/profile?enc_uservNNxAAAACekBSFzGfp3c0JGkxbm9bX

Donc erreur ou pas erreur, c'est qu'un homme et de là à parler de la
couleur de cheveux de sa collègue... pfff

Par pitié, lancez-vous pas dans des explications ou réflexions à deux
balles, je connais pas Fred Brouard plus que vous mais je l'ai jamais vu
dénigré personne sur ce forum...

Jérôme
Avatar
EmanuelL
C'est Monsieur semble avoir de comptes à régler avec Fred,
malheureusement ici ce n'est pas l'endroit pour ce genre de choses.

Monsieur Joel Chaudy, pouvez-vous faire quelque chose?

--

*!* -----------------------------------
EmanuelL
Membre d'AtoutFox
www.atoutfox.org
1 2