Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

is there possibility to have procedure which sents emails from SQL Server 2008 where I can type sender e-mail address?

Thanks

share|improve this question

1 Answer 1

In SQL Server 2008 use Database Mail, not SQL Mail to send email. SQL Mail is legacy & will be removed in future versions.

You will first need to configure Database Mail

Once a profile has been setup for Database Mail, use the sp_send_dbmail stored procedure.

EDIT:

It works fine for me when i use a different @from_address from what is specified as the email address in the profile. This address is only used when i don't specify a from_address. Code I used to send the email is below:

EXEC msdb.dbo.sp_send_dbmail 
@profile_name='nick '
, @from_address ='Nick Kavadias <nick.kavadias@example.com>'
, @recipients='other_address@example.com'
, @subject='this is a test message'
, @body='t.e.s.t m.e.s.s.a.g.e'

A screen shot of my mail profile settings are below:

alt text

Is the mail being queued? Do you have any logs from your SMTP server?

Check that there aren't any error in the database mail log table msdb.dbo.sysmail_event_log

Failing that, check that it's not something the mail server is disallowing.

share|improve this answer
    
You are right. But this procedure is not allowing to give sender e-mail or reply to address. I want to achieve this by not adding new e-mail account to Database Mail when every time I want to use different sender e-mail address (or reply to). Is this possible? –  GrZeCh Oct 24 '09 at 14:21
    
database mail is working as expected. I've updated my post –  Nick Kavadias Oct 27 '09 at 1:11

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.