Click here to Skip to main content
15,887,776 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
i want to send email from sql server ...

i m
SQL
use master
go
sp_configure 'show advanced options',1
go
reconfigure with override
go
sp_configure 'Database Mail XPs',1
--go
--sp_configure 'SQL Mail XPs',0
go
reconfigure
go


EXECUTE msdb.dbo.sysmail_add_account_sp
@account_name = 'MyMailAccount2',
@description = 'Mail account for Database Mail',
@email_address = 'dilip.aim12@gmail.com',
@display_name = 'MyAccount',
@username='dilip.aim12@gmail.com',
@password='*********',
@mailserver_name = 'smtp.gmail.com'


EXECUTE msdb.dbo.sysmail_add_profile_sp
@profile_name = 'MyMailProfile2',
@description = 'Profile used for database mail'

EXECUTE msdb.dbo.sysmail_add_profileaccount_sp
@profile_name = 'MyMailProfile2',
@account_name = 'MyMailAccount2',
@sequence_number = 1

EXECUTE msdb.dbo.sysmail_add_principalprofile_sp
@profile_name = 'MyMailProfile2',
@principal_name = 'public',
@is_default = 1

declare @body1 varchar(100)
set @body1 = 'Server :'+@@servername+ ' My First Database Email '
EXEC msdb.dbo.sp_send_dbmail @recipients='dilip.aim11@gmail.com',
@subject = 'My Mail Test',
@body = @body1,
@body_format = 'HTML' ;




message is coming
VB
Mail queued.



but i not able to received the mail...
give any solution...
Posted
Updated 24-Jul-11 23:17pm
v2

1 solution

 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900