Link to home
Start Free TrialLog in
Avatar of Petter A. Halseth
Petter A. HalsethFlag for Norway

asked on

SQL DBMail strange behavour

Hi,
I have a strange thing going on on our SQL server 2008 . I have 2 mail profiles set up. One for internal use and one who sends mail to our customers (customer service).

There is only one T-SQL job that uses the customer service profile and this job works fine.
The internal profile is in use "all over the place" in several scripts and jobs.
I have never experienced any strange things with the customer service mails.

But on the internal mails strange things happens, all of these are set up to use the internal profile. But sometimes it uses the customer service profile.
E.g. I have a loop that sends an email to all our shops with information. And suddenly in the middle of a loop ONE email is sent using the customer service profile.
I'm unable to reproduce this so I'm kind of stuck.. This happens a few times a week.

Here is the code I'm using:
Internal:
EXECUTE msdb.dbo.sp_send_dbmail @profile_name = 'InternalProfile', @recipients = @mottagere, @copy_recipients = @mottagereCC, @subject = @emne, @body_format = 'HTML', @body = @epost, @file_attachments = @filvedlegg

Open in new window


Customer service:
EXECUTE msdb.dbo.sp_send_dbmail @profile_name = 'CustomerService',@body_format = 'HTML', @recipients = @mailAdresse,@blind_copy_recipients = @BCC_Recipents, @subject = @mailSubject,@body = @meldingEpost

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of Ryan McCauley
Ryan McCauley
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Petter A. Halseth

ASKER

You are correct, I've missed this one. The internal profile was set up with 2 smtp accounts, where the customer service was priority 2.

Easy solution on a frustrating problem! Thanx!