Solved

SQL DBMail strange behavour

Posted on 2013-02-06
2
304 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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If you have heard of RFC822 date formats, they can be quite a challenge in SQL Server. RFC822 is an Internet standard format for email message headers, including all dates within those headers. The RFC822 protocols are available in detail at:   ht…
In this article I will describe the Copy Database Wizard method as one possible migration process and I will add the extra tasks needed for an upgrade when and where is applied so it will cover all.
This is a video describing the growing solar energy use in Utah. This is a topic that greatly interests me and so I decided to produce a video about it.
Concerto provides fully managed cloud services and the expertise to provide an easy and reliable route to the cloud. Our best-in-class solutions help you address the toughest IT challenges, find new efficiencies and deliver the best application expe…

911 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

20 Experts available now in Live!

Get 1:1 Help Now