Hi everyonei get an error messgae running the following codeDECLARE @mailist VARCHAR(max)SET @mailist=''SELECT TOP 1 @mailist=@mailist + email +';'FROMemail.dbo.mytableSET @mailist=STUFF(@mailist,LEN(@mailist),1,'')SET @mailist='''' + @mailist + ''''EXEC msdb.dbo.sp_send_dbmail @profile_name='my_mail_profile',@recipients=@mailist,@subject='mysubject',@body_format='html',@body='<html> <head> <title> problems with send_dbmail </title> </head> <body> this is not working </body></html>'
The error says:quote:
Syntax error in parameters or arguments. The server response was: 5.5.4 Invalid Address)