meteorelec
asked on
Performance Issue with XP_SMTP_SENDMAIL
It takes 15sec to send a single email using this stored procedure,
i'm looking to send out over 2000 emails using a cursor,
This would take over 8hours,
whilst with the xp_sendmail its practically instant,
Can you see why this would be?
I've attach my code below (i am sending from my exchange server on my network)
i'm looking to send out over 2000 emails using a cursor,
This would take over 8hours,
whilst with the xp_sendmail its practically instant,
Can you see why this would be?
I've attach my code below (i am sending from my exchange server on my network)
declare @rc int
exec @rc = master.dbo.xp_smtp_sendmail
@FROM = N'autoemail@meteorelectrical.com',
@FROM_NAME = N'Automated Email',
@TO = N'eoin.conway@meteorelectrical.com',
@subject = N'Hello HTML SQL Server SMTP Mail',
@message = N'<HTML><H1>this is some content for the body part object</H1></HTML>',
@type = N'text/html',
@server = N'EXCHANGESRV'
select RC = @rc
if you remove the mail-sending code from the process, and just allow it to run through the cursor doing everything else (if anything), how long does it take? Answering that question will narrow the field and tell us whether the bottleneck is in the mail-sending bit or not.
ASKER
I remove the @message param an it is still just as slow,
To keep things simple i am working from the code attached above and i am not using a cursor,
it takes 15sec to send one email.
To keep things simple i am working from the code attached above and i am not using a cursor,
it takes 15sec to send one email.
ASKER CERTIFIED SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.