Thursday, April 1, 2010

xp_sendmail: Procedure expects parameter @user, which was not supplied.

Hello...

When you try to send E-mail from your SQL Server 2005 T-SQL with xp_sendmail, there will be an error message shown as follows:

xp_sendmail: Procedure expects parameter @user, which was not supplied.

And probably when you try to pass @user also, it will say invalid parameter.

It seems in SQL Server 2005, xp_sendmail is obsolete and we can use sp_send_dbmail instead.

Following is the syntax:

EXEC msdb.dbo.sp_send_dbmail
@recipients='vm.mohammedfauzi@gmail.com',
@subject = 'SQL:DataBase Mail Test',
@body = 'Hello Test From SQL.Hello Test From SQL.',
@profile_name = 'The Profile you created in Configure Database Mail',
@body_format = 'HTML'

The following link has screen shots to setup Email Profile in SQL Server : Click Here

Hope it helps

Fauzi

No comments: