Advertisement

07.07.2008 at 02:54PM PDT, ID: 23544932
[x]
Attachment Details

send email from SQL with username and password

Asked by mcrmg in MS SQL Server

hi,

currently, I use the following code to send email from SQL, our email provider recently changed theor email, we need to login in using username password before we send email out...how can I get this to work?  thx

SET QUOTED_IDENTIFIER ON
GO
SET ANSI_NULLS ON
GO










ALTER           PROCEDURE dbo.st_SendEmail

@S_FROM_NAME varchar(50), @S_subject varchar(50), @S_message varchar(100)

AS

SET NOCOUNT ON

            declare @rc int

            
            exec @rc = master.dbo.xp_smtp_sendmail
                @FROM       = N'someemail@domain.com',
                @FROM_NAME  = @S_FROM_NAME,
            
                @replyto    = N'someemail@domain.com',
                @TO         = N'someemail@domain.com',
                @CC         = N'',
                @BCC        = N'',
                @priority   = N'NORMAL',
                @subject    = @S_subject,
            
                @type       = N'text/plain',
                @message    = @S_message,
            
                @messagefile= N'',
                @attachment = N'',
            
                @attachments= N'',
                @codepage   = 0,
            
                @timeout    = 10000,
                @server     = N'putgoing.email.server'
            select RC = @rc
            
            


GO
SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS ON
GO

Start Free Trial
[+][-]07.07.2008 at 04:09PM PDT, ID: 21949374

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]07.07.2008 at 05:55PM PDT, ID: 21949920

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]07.07.2008 at 10:02PM PDT, ID: 21951032

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]07.08.2008 at 05:49AM PDT, ID: 21953219

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]07.08.2008 at 06:42PM PDT, ID: 21959984

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zone: MS SQL Server
Sign Up Now!
Solution Provided By: acperkins
Participating Experts: 2
Solution Grade: A
 
 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628