473,242 Members | 1,319 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,242 software developers and data experts.

how can i send mail by using sql server

hi all

my query is how can i send mail by using sql server, i think by unsing
xp_sendmail store procedure we can do this but my problem is what
paramater to be pass to this store procedure if i want to send mail
from my local machine to another user, bcos i am geeting this error
msg in query analyzer...

query:-EXEC master..xp_sendmail 'ss35934' (ss35934 is valid user name
present into my local nerwork)

getting error msg :- xp_sendmail: failed with mail error 0x80040111

from:- sachin shah

Aug 24 '07 #1
3 5978
On Aug 24, 7:47 am, sachin shah <sachin28...@gmail.comwrote:
hi all

my query is how can i send mail by using sql server, i think by unsing
xp_sendmail store procedure we can do this but my problem is what
paramater to be pass to this store procedure if i want to send mail
from my local machine to another user, bcos i am geeting this error
msg in query analyzer...

query:-EXEC master..xp_sendmail 'ss35934' (ss35934 is valid user name
present into my local nerwork)

getting error msg :- xp_sendmail: failed with mail error 0x80040111

from:- sachin shah
I had a similar problem and was advised not to use xp_sendmail. I
don't understand how sql server communicates with email. I don't know
the difference between using xp_sendmail (does not work) and sending a
notification email in the job scheduler (which does work)!

There's an alternative you could try which is available from
http://www.sqldev.net/xp/xpsmtp.htm
Aug 24 '07 #2
On Aug 24, 12:57 pm, stephen <m0604...@googlemail.comwrote:
On Aug 24, 7:47 am, sachin shah <sachin28...@gmail.comwrote:
hi all
my query is how can i send mail by using sql server, i think by unsing
xp_sendmail store procedure we can do this but my problem is what
paramater to be pass to this store procedure if i want to send mail
from my local machine to another user, bcos i am geeting this error
msg in query analyzer...
query:-EXEC master..xp_sendmail 'ss35934' (ss35934 is valid user name
present into my local nerwork)
getting error msg :- xp_sendmail: failed with mail error 0x80040111
from:- sachin shah

I had a similar problem and was advised not to use xp_sendmail. I
don't understand how sql server communicates with email. I don't know
the difference between using xp_sendmail (does not work) and sending a
notification email in the job scheduler (which does work)!

There's an alternative you could try which is available fromhttp://www.sqldev.net/xp/xpsmtp.htm

hi stephen,

i tried with xp_smtp_sendmail but still getting the error ....
as given into site i register the xp_smtp_sendmail store procedure and
the assign the grant permission to that store procedure then writing
the following query

declare @rc int
exec @rc = master.dbo.xp_smtp_sendmail
@FROM = N'*******@MyDomain.com',
@TO = N'********@HisDomain.com'
select RC = @rc
go

in place of this 'M******@MyDomain.com' i am writing the real mail id
(first one)
in place of this 'M*******@HisDomain.com' i am writing the real mail
id (second one)

but after executing these query getting the following error msg..

Error: connecting to server smarthost

can u plz tell me is there any sql server id we need to right into
above query (like ad***@sqlserver.com)

from sachin shah

Aug 24 '07 #3
sachin shah (sa*********@gmail.com) writes:
as per u r guide line i insatalled that xp_smtp_sendmail store
procedure and assign the grant permission to that SP but after
executing the following query its showing following error....

declare @rc int
exec @rc = master.dbo.xp_smtp_sendmail
@FROM = N'*******@MyDomain.com',
@FROM_NAME = N'My Full Name',
@replyto = N'******@systime.net',
@TO = N'sa*********@gmail.com',
@priority = N'NORMAL',
@subject = N'Hello SQL Server SMTP Mail',
@type = N'text/plain',
@message = N'Goodbye MAPI, goodbye Outlook',
@timeout = 10000,
@server = N'mail.sqldev.net'
select RC = @rc
go
Error Dispalyed:-
Error: sending message
Server response: 451 Local Error
put; end with <CRLF>.<CRLF>

give me the proper solution
What is says. That is a message from the SMTP server. SMTP requires
that you terminate your message with a dot on a single line. I have
never user xp_smtp_sendmail, but apparently it does not add this dot
for you.

But you should change the SMTP server to the one that you normally use.
SMTP servers do normally not require authentication; anyone connect.
However, an SMTP server is set up to server a set of IP addresses, and if
neither the sender nor the receiver is in that set, the SMTP server should
refused to transmit the mail.
(Note :- What is this MAPI and by where it is references in sql
server )
MAPI is the mail protocol used by Outlook and other Microsoft mail
program, and it does not have much to do with SQL Server as such.

--
Erland Sommarskog, SQL Server MVP, es****@sommarskog.se

Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/pro...ads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinf...ons/books.mspx
Aug 29 '07 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Edward | last post by:
My computer is at intranet,I want to use following code to realizing function of sending mail.But this program only can send mail between intranet.If I send mail in internet,I need to through proxy...
0
by: Henrik Bergman | last post by:
Hi all As I subscribe MSDN I got an USB-memory with Microsoft eLearing library. I found an exampell how to send SMTP e-mail using CDO.Message object and CDO.Configuration. But when I try to...
0
by: Elankathir S.N. | last post by:
Hi All, I’m using ASP with VBScript…and I need to send mails using Lotus Notes Mail Server (IBM). How to communicate to the Lotus Notes Server and send mails??? Thanks, - Elan
2
by: Senthilkumar | last post by:
Hi, I would like to send mail using Outlook or Outlook Express my .net program which is written using vb.net . When ever a new record of particular type is added, i would like to send an...
0
by: Tidan | last post by:
Hi, I would like to send mail using Outlook Express my .net program which is written using vb.net 2.0. When ever a new record of particular type is added, i would like to send an automatic mail...
6
by: AbraAbraCadabra | last post by:
Here is the code I have been using to send mail... Set objCDO = Server.CreateObject("CDO.Message") With objCDO .To = strTo .From = "markus@domain.com" .Subject = "This is the...
2
by: Max | last post by:
hi I am using System.Web.Mail.MailMessage with System.Web.Mail.SmtpMail to send mail. now the my question is, Is it compulsory to add fields smtpauthenticate, sendusername and sendpassword...
12
by: Geethu03 | last post by:
Hi to all I am a new member to this group. I have a problem in Email Sending using java. That is the mail is sending from my server to any desired mail account. By using the html i created the form...
0
by: PraveenKatiyar | last post by:
Hi, when i send mail using xp_smtp_sendmail it gives error--- Server response: 554 <libsoft@iitk.ac.in>: Sender address rejected: Access denied I m using-- declare @rc int exec @rc =...
2
acoder
by: acoder | last post by:
How to Send Mail in Coldfusion You can use Coldfusion to easily send mail. From simple plain text emails to more complex HTML and multipart emails, the job is made a lot easier with Coldfusion. ...
0
by: abbasky | last post by:
### Vandf component communication method one: data sharing ​ Vandf components can achieve data exchange through data sharing, state sharing, events, and other methods. Vandf's data exchange method...
0
by: stefan129 | last post by:
Hey forum members, I'm exploring options for SSL certificates for multiple domains. Has anyone had experience with multi-domain SSL certificates? Any recommendations on reliable providers or specific...
1
by: davi5007 | last post by:
Hi, Basically, I am trying to automate a field named TraceabilityNo into a web page from an access form. I've got the serial held in the variable strSearchString. How can I get this into the...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: Aftab Ahmad | last post by:
Hello Experts! I have written a code in MS Access for a cmd called "WhatsApp Message" to open WhatsApp using that very code but the problem is that it gives a popup message everytime I clicked on...
0
by: Aftab Ahmad | last post by:
So, I have written a code for a cmd called "Send WhatsApp Message" to open and send WhatsApp messaage. The code is given below. Dim IE As Object Set IE =...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.