Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

SQL DBMail strange behavour

Posted on 2013-02-06
2
Medium Priority
?
311 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 2000 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

Nothing ever in the clear!

This technical paper will help you implement VMware’s VM encryption as well as implement Veeam encryption which together will achieve the nothing ever in the clear goal. If a bad guy steals VMs, backups or traffic they get nothing.

Question has a verified solution.

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

After restoring a Microsoft SQL Server database (.bak) from backup or attaching .mdf file, you may run into "Error '15023' User or role already exists in the current database" when you use the "User Mapping" SQL Management Studio functionality to al…
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.
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…

688 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