Link to home
Create AccountLog in
Avatar of BravehearT-1326
BravehearT-1326Flag for United Kingdom of Great Britain and Northern Ireland

asked on

Sending mail using SP_SEND_DBMAIL stored proc

Hi experts - got a query regarding sp_send_dbmail stored proc and sending to multiple recipients.

I know that multiple recipients MUST be seperated by a ; (semi-colon) however if someone passes multiple address into the recipients parameter and separates them with a , (comma) is there a record to show that the email addresses that did not receive the email because of the ,(comma) used to separate them.

From what I've checked it always reports as successful as the first recipient is valid but cant see any entry for ones after that.

All help appreciated.
Avatar of Vazgen
Vazgen
Flag of United States of America image

I recommend to split @recipients before sending email checking both ',' and ';' separators , then send it one by one for each receipient.
Avatar of jar3817
jar3817

How about you just use REPLACE() in your query on recipients input to change any commas to semicolons?

REPLACE(recips,',',';');
ASKER CERTIFIED SOLUTION
Avatar of BravehearT-1326
BravehearT-1326
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
Create an account to see this answer
Signing up is free. No credit card required.
Create Account
Avatar of BravehearT-1326

ASKER

I found that if you search the sysmail_allitems table you can see if someone has accidently used commas instead of semi-colons in their code.  I suppose another way would be to query the email logs from Exchange etc  to see if any unreturned / invalid addresses are seen as well.
select * from sysmail_allitems where recipients like '%,%'

Open in new window