Solved

SQL DBMail strange behavour

Posted on 2013-02-06
2
302 Views
Last Modified: 2013-02-07
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

0
Comment
Question by:Petter A. Halseth
2 Comments
 
LVL 28

Accepted Solution

by:
Ryan McCauley earned 500 total points
ID: 38863005
Is the internal profile set up with multiple SMTP Accounts? Database Mail gives you the option to add multiple servers so that if one is unavailable, it can attempt the next one. It may not be using the customer service profile necessarily, but just sending mail that looks as though it is, if it's connecting to the mail server the same way that profile does.

To confirm this, open your "Internal" profile and see what SMTP server entries are listed there.

As a side note, I've never seen this happen - I've dealt with multiple profiles on a number of servers and have set up jobs to use both, and I've not observed this behavior. There may be something specific you're doing to trigger it, if it's indeed a bug.
0
 

Author Comment

by:Petter A. Halseth
ID: 38863034
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!
0

Featured Post

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

This article explains how to reset the password of the sa account on a Microsoft SQL Server.  The steps in this article work in SQL 2005, 2008, 2008 R2, 2012, 2014 and 2016.
Ever needed a SQL 2008 Database replicated/mirrored/log shipped on another server but you can't take the downtime inflicted by initial snapshot or disconnect while T-logs are restored or mirror applied? You can use SQL Server Initialize from Backup…
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

757 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now