Solved

SQL DBMail strange behavour

Posted on 2013-02-06
2
309 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Optimizing Cloud Backup for Low Bandwidth

With cloud storage prices going down a growing number of SMBs start to use it for backup storage. Unfortunately, business data volume rarely fits the average Internet speed. This article provides an overview of main Internet speed challenges and reveals backup best practices.

Question has a verified solution.

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

This is basically a blog post I wrote recently. I've found that SARGability is poorly understood, and since many people don't read blogs, I figured I'd post it here as an article. SARGable is an adjective in SQL that means that an item can be fou…
SQL Server engine let you use a Windows account or a SQL Server account to connect to a SQL Server instance. This can be configured immediatly during the SQL Server installation or after in the Server Authentication section in the Server properties …
There's a multitude of different network monitoring solutions out there, and you're probably wondering what makes NetCrunch so special. It's completely agentless, but does let you create an agent, if you desire. It offers powerful scalability …
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…

734 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