Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 SQL Server Administration (2005)
 Database mail

Author  Topic 

BendJoe
Posting Yak Master

128 Posts

Posted - 2011-10-24 : 12:12:44
Hi,
I was trying(for the first time) to set up database mail for sending emails after a successful job execution. When I try to sent a test mail the log message is like this.
"The mail could not be sent to the reciepients because of the mail server failure.(Sending mail using Account 1(date time). Exception Message:Cannot send mails to mail server.(Mailbox unavailable.The server response was:5.7.1 Unable to relay for xxxx@gmail.com)".

How can I fix this issue.
Thanks

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2011-10-24 : 12:16:50
did you set up profile correctly?

see

http://blog.sqlauthority.com/2008/08/23/sql-server-2008-configure-database-mail-send-email-from-sql-database/

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

BendJoe
Posting Yak Master

128 Posts

Posted - 2011-10-24 : 13:52:03
Thanks for the link it helped. Is there a way I can sent a message which will take some data from the job execution. Like the number of rows affected in the job.
Thanks
quote:
Originally posted by visakh16

did you set up profile correctly?

see

http://blog.sqlauthority.com/2008/08/23/sql-server-2008-configure-database-mail-send-email-from-sql-database/

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/



Go to Top of Page

skybvi
Posting Yak Master

193 Posts

Posted - 2011-10-24 : 15:00:32
YOu can put all the code of execution in a SP and then exec the sp from a job with a schedule.

EXEC msdb.dbo.sp_send_dbmail

http://syntaxhelp.com/SQLSERVER/dbmail

in above link, you can see
sending database mail part


Regards,
Sushant
DBA
West Indies
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2011-10-25 : 00:05:56
quote:
Originally posted by BendJoe

Thanks for the link it helped. Is there a way I can sent a message which will take some data from the job execution. Like the number of rows affected in the job.
Thanks
quote:
Originally posted by visakh16

did you set up profile correctly?

see

http://blog.sqlauthority.com/2008/08/23/sql-server-2008-configure-database-mail-send-email-from-sql-database/

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/






see

http://blogs.msdn.com/b/sqlagent/archive/2010/11/03/sql-database-mail-send-t-sql-results-by-email.aspx

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

Cindyaz
Yak Posting Veteran

73 Posts

Posted - 2011-10-25 : 04:49:42
You can also send formatted output of the t-sql in HTML format (if you need to).

see this link - [url]http://www.sqlservercentral.com/blogs/robert_davis/archive/2010/06/15/Building-HTML-Emails-With-SQL-Server-and-XML.aspx [/url]

Go to Top of Page
   

- Advertisement -