Showing posts with label mail. Show all posts
Showing posts with label mail. Show all posts

Tuesday, March 27, 2012

Configuration of Database Mail

Has anyone been able to configure Database Mail and successfully send an email message? I set it up this afternoon, but all my messages are sitting in the sys_mailitems table of the msdb database.

We use Novell GroupWise as our email client, but we have not installed GroupWise on this server. Can I configure the IIS SMTP server to send the email messages?

These are the steps I have taken thus far:


ALTER DATABASE AdventureWorks SET ENABLE_BROKER;

GO

EXECUTE msdb.dbo.sysmail_start_sp;

GO

EXEC msdb.dbo.sp_send_dbmail
@.profile_name = 'CLG_SQLMail',
@.recipients = 'username@.domain.com',
@.body = 'This is only a test. Had this been a real system problem you would already be pulling your hair out. ',
@.subject = 'SQL Server 2005 - Database Mail System Test'

GO

CREATE ENDPOINT SQLMail_Endpoint
STATE = STARTED
AS TCP ( LISTENER_PORT = 25 )
FOR SERVICE_BROKER (
AUTHENTICATION = WINDOWS NEGOTIATE,
ENCRYPTION = REQUIRED
)

GO

Thanks in advance,
Ken

After a few weeks of frustrating trial and error, I was able to successfully configure Database Mail. Here are the steps I followed:

Prerequisites:
1) Make sure that IIS is installed
2) Make sure that the SMTP service has been installed. (This service runs within IIS.)
3) Create a valid email account for Database Mail to use

Configuration Steps:
1) Go to the Object Browser and expand the "Management" tree
2) Right-click on "Database Mail" and select "Configure Database Mail" to start the "Database Mail Configuration Wizard"
3) Navigate through the screens of the wizard, entering the appropriate information for your environment. In our case, I use an SMTP relay server as the server for the Database Mail Account.
4) When you are finished with the wizard, go to the Management Studio and connect to the instance.
5) Open a query window and connect to the master database
6) Run the following script:


EXEC sp_configure 'show advanced options', 1;
GO
RECONFIGURE
GO
EXEC sp_configure 'Database Mail XPs', 1;
GO
RECONFIGURE
GO

7) Run the following script:



EXEC msdb..sysmail_start_sp;

8) Now go to the "SQL Server Configuration Manager"
9) Stop and restart both the SQL Server service and the SQL Server Agent service.

When I first tried to set up Database Mail, I did not restart these services. That was the reason my mail was stuck in the queue. The Books Online article on "sp_configure" needs to specify which of the options requires a restart of the services!

10) Go back to the Management Studio and create a test message using the sp_send_dbmail stored procedure.
11) The message should appear in your Inbox within a minute or two

NOTE: In our environment, we have an alternate email domain. I could only send messages using the primary domain, which I assume is due to the configuration of the SMTP relay server.|||One follow up in regard to restarting services. The following is the order in which you must execute the stored procedures and restart the services whenever you make a change to the Database Mail configuration:

1) Execute the following script in the query window:

EXECUTE msdb..sysmail_stop_sp;

GO

2) When the script completes, stop the following services, in the order listed below:
a. SQL Server Agent
b. SQL Server
c. SMTP Service

3) Restart the following services in the order listed below:
a. SMTP Service
b. SQL Server
c. SQL Server Agent

4) Execute the following script in the query window:

EXECUTE msdb..sysmail_start_sp;

GO


5) Send your test message again to confirm that everything is working correctly

|||Hi,

I have followed all these steps. I still can't send mail. The error message from the table: sysmail_log is:
The mail could not be sent to the recipients because of the mail server failure. (Sending Mail using Account 1 (2005-10-14T10:48:48). Exception Message: Cannot send mails to mail server. (The message could not be sent to the SMTP server. The transport error code was 0x80040217. The server response was not available ). )

My profile is set to use my Comcast account (cable modem).
Any ideas? Are there any public smtp servers I could use to test database mail?

Regards,
Asim.
|||

Hi Ken,

I was having this same issue.

I resolved my issue by putting in the correct groupwise mail server name and pointing it to use port 25 (default). Be sure that you are using the right mail host server name in your account profile.

I did not have to jump through any extra hoops, it worked right after I made change.

Let me know if that helps.

Thanks,

*T*

Configuration of Database Mail

Has anyone been able to configure Database Mail and successfully send an email message? I set it up this afternoon, but all my messages are sitting in the sys_mailitems table of the msdb database.

We use Novell GroupWise as our email client, but we have not installed GroupWise on this server. Can I configure the IIS SMTP server to send the email messages?

These are the steps I have taken thus far:


ALTER DATABASE AdventureWorks SET ENABLE_BROKER;

GO

EXECUTE msdb.dbo.sysmail_start_sp;

GO

EXEC msdb.dbo.sp_send_dbmail
@.profile_name = 'CLG_SQLMail',
@.recipients = 'username@.domain.com',
@.body = 'This is only a test. Had this been a real system problem you would already be pulling your hair out. ',
@.subject = 'SQL Server 2005 - Database Mail System Test'

GO

CREATE ENDPOINT SQLMail_Endpoint
STATE = STARTED
AS TCP ( LISTENER_PORT = 25 )
FOR SERVICE_BROKER (
AUTHENTICATION = WINDOWS NEGOTIATE,
ENCRYPTION = REQUIRED
)

GO

Thanks in advance,
Ken

After a few weeks of frustrating trial and error, I was able to successfully configure Database Mail. Here are the steps I followed:

Prerequisites:
1) Make sure that IIS is installed
2) Make sure that the SMTP service has been installed. (This service runs within IIS.)
3) Create a valid email account for Database Mail to use

Configuration Steps:
1) Go to the Object Browser and expand the "Management" tree
2) Right-click on "Database Mail" and select "Configure Database Mail" to start the "Database Mail Configuration Wizard"
3) Navigate through the screens of the wizard, entering the appropriate information for your environment. In our case, I use an SMTP relay server as the server for the Database Mail Account.
4) When you are finished with the wizard, go to the Management Studio and connect to the instance.
5) Open a query window and connect to the master database
6) Run the following script:


EXEC sp_configure 'show advanced options', 1;
GO
RECONFIGURE
GO
EXEC sp_configure 'Database Mail XPs', 1;
GO
RECONFIGURE
GO

7) Run the following script:



EXEC msdb..sysmail_start_sp;

8) Now go to the "SQL Server Configuration Manager"
9) Stop and restart both the SQL Server service and the SQL Server Agent service.

When I first tried to set up Database Mail, I did not restart these services. That was the reason my mail was stuck in the queue. The Books Online article on "sp_configure" needs to specify which of the options requires a restart of the services!

10) Go back to the Management Studio and create a test message using the sp_send_dbmail stored procedure.
11) The message should appear in your Inbox within a minute or two

NOTE: In our environment, we have an alternate email domain. I could only send messages using the primary domain, which I assume is due to the configuration of the SMTP relay server.|||One follow up in regard to restarting services. The following is the order in which you must execute the stored procedures and restart the services whenever you make a change to the Database Mail configuration:

1) Execute the following script in the query window:

EXECUTE msdb..sysmail_stop_sp;

GO

2) When the script completes, stop the following services, in the order listed below:
a. SQL Server Agent
b. SQL Server
c. SMTP Service

3) Restart the following services in the order listed below:
a. SMTP Service
b. SQL Server
c. SQL Server Agent

4) Execute the following script in the query window:

EXECUTE msdb..sysmail_start_sp;

GO


5) Send your test message again to confirm that everything is working correctly

|||Hi,

I have followed all these steps. I still can't send mail. The error message from the table: sysmail_log is:
The mail could not be sent to the recipients because of the mail server failure. (Sending Mail using Account 1 (2005-10-14T10:48:48). Exception Message: Cannot send mails to mail server. (The message could not be sent to the SMTP server. The transport error code was 0x80040217. The server response was not available ). )

My profile is set to use my Comcast account (cable modem).
Any ideas? Are there any public smtp servers I could use to test database mail?

Regards,
Asim.
|||

Hi Ken,

I was having this same issue.

I resolved my issue by putting in the correct groupwise mail server name and pointing it to use port 25 (default). Be sure that you are using the right mail host server name in your account profile.

I did not have to jump through any extra hoops, it worked right after I made change.

Let me know if that helps.

Thanks,

*T*

Configuration of Database Mail

Has anyone been able to configure Database Mail and successfully send an email message? I set it up this afternoon, but all my messages are sitting in the sys_mailitems table of the msdb database.

We use Novell GroupWise as our email client, but we have not installed GroupWise on this server. Can I configure the IIS SMTP server to send the email messages?

These are the steps I have taken thus far:


ALTER DATABASE AdventureWorks SET ENABLE_BROKER;

GO

EXECUTE msdb.dbo.sysmail_start_sp;

GO

EXEC msdb.dbo.sp_send_dbmail
@.profile_name = 'CLG_SQLMail',
@.recipients = 'username@.domain.com',
@.body = 'This is only a test. Had this been a real system problem you would already be pulling your hair out. ',
@.subject = 'SQL Server 2005 - Database Mail System Test'

GO

CREATE ENDPOINT SQLMail_Endpoint
STATE = STARTED
AS TCP ( LISTENER_PORT = 25 )
FOR SERVICE_BROKER (
AUTHENTICATION = WINDOWS NEGOTIATE,
ENCRYPTION = REQUIRED
)

GO

Thanks in advance,
Ken

After a few weeks of frustrating trial and error, I was able to successfully configure Database Mail. Here are the steps I followed:

Prerequisites:
1) Make sure that IIS is installed
2) Make sure that the SMTP service has been installed. (This service runs within IIS.)
3) Create a valid email account for Database Mail to use

Configuration Steps:
1) Go to the Object Browser and expand the "Management" tree
2) Right-click on "Database Mail" and select "Configure Database Mail" to start the "Database Mail Configuration Wizard"
3) Navigate through the screens of the wizard, entering the appropriate information for your environment. In our case, I use an SMTP relay server as the server for the Database Mail Account.
4) When you are finished with the wizard, go to the Management Studio and connect to the instance.
5) Open a query window and connect to the master database
6) Run the following script:


EXEC sp_configure 'show advanced options', 1;
GO
RECONFIGURE
GO
EXEC sp_configure 'Database Mail XPs', 1;
GO
RECONFIGURE
GO

7) Run the following script:



EXEC msdb..sysmail_start_sp;

8) Now go to the "SQL Server Configuration Manager"
9) Stop and restart both the SQL Server service and the SQL Server Agent service.

When I first tried to set up Database Mail, I did not restart these services. That was the reason my mail was stuck in the queue. The Books Online article on "sp_configure" needs to specify which of the options requires a restart of the services!

10) Go back to the Management Studio and create a test message using the sp_send_dbmail stored procedure.
11) The message should appear in your Inbox within a minute or two

NOTE: In our environment, we have an alternate email domain. I could only send messages using the primary domain, which I assume is due to the configuration of the SMTP relay server.|||One follow up in regard to restarting services. The following is the order in which you must execute the stored procedures and restart the services whenever you make a change to the Database Mail configuration:

1) Execute the following script in the query window:

EXECUTE msdb..sysmail_stop_sp;

GO

2) When the script completes, stop the following services, in the order listed below:
a. SQL Server Agent
b. SQL Server
c. SMTP Service

3) Restart the following services in the order listed below:
a. SMTP Service
b. SQL Server
c. SQL Server Agent

4) Execute the following script in the query window:

EXECUTE msdb..sysmail_start_sp;

GO


5) Send your test message again to confirm that everything is working correctly

|||Hi,

I have followed all these steps. I still can't send mail. The error message from the table: sysmail_log is:
The mail could not be sent to the recipients because of the mail server failure. (Sending Mail using Account 1 (2005-10-14T10:48:48). Exception Message: Cannot send mails to mail server. (The message could not be sent to the SMTP server. The transport error code was 0x80040217. The server response was not available ). )

My profile is set to use my Comcast account (cable modem).
Any ideas? Are there any public smtp servers I could use to test database mail?

Regards,
Asim.
|||

Hi Ken,

I was having this same issue.

I resolved my issue by putting in the correct groupwise mail server name and pointing it to use port 25 (default). Be sure that you are using the right mail host server name in your account profile.

I did not have to jump through any extra hoops, it worked right after I made change.

Let me know if that helps.

Thanks,

*T*

Sunday, March 25, 2012

Config SQL Server 2000 mail with Outlook 2002

We have a SQL Advance server 2000 running SQL Server 2000 SP3 and has
Outlook 2002 installed. The SQL Agent runs under the account
ghs2000\sqlexec.
I logged into this machine as ghs2000\sqlexec and setup a POP3 account
on the machine. Tested sending emails and test mails from SQL Server
and they work fine.
Now we log into the machine as a different user, it's normally logged in
as ghs2000\madmin. And we leave Outlook running. But the emails from
SQL Server never get sent out. They won't get sent out unless we log
into the server as ghs2000\sqlexec and open Outlook 2002.
Any way to set this up so the messages are sent out regardless of who is
logged in? Is this a limitation in Outlook 2002 or would the same thing
happen in Outlook 2002?
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!Hi
This may be happening!
From http://support.microsoft.com/default.aspx?scid=kb;pl;263556
WARNING: If you attempt to use SQL Mail to establish a connection to a
POP3/SMTP mail server you MUST be able to repeatedly connect and send mail
by using the following steps:
1.. Click the icon that starts the mail client.
2.. Send a message to the same e-mail address listed in the profile so
that you can test both the send and receive capability.
3.. Exit the mail client.
4.. Repeat steps 1 through 3 several times to simulate expected e-mail
traffic.
NOTE: If at any time during this process any dialog boxes appear that
require a response (such as clicking OK to log on) or you are prompted to
enter a password, it will not work with SQL Mail. For an Internet mail
connection to work with SQL Mail, you must have 100% connectivity or SQL
Mail is not usable and you might have to restart your server to clear up the
problem.
The reason for this is that SQL Mail does not provide for retries when
accessing a POP3 account. If SQL Mail cannot connect to the POP3 server on
the first attempt, the Internet Mail Connector normally opens a dialog box
that prompts you to click OK to retry. It that should occur, SQL Mail, which
is running as part of the MSSQLServer service, never sees the dialog box and
stops responding at this point. You might have to stop the Mapisp32.exe
application or even restart your Windows NT computer to clear the problem.
You may be better off using SMTP? http://www.sqldev.net/xp/xpsmtp.htm
John
"Colin Colin" <ccole@.ghs.guthrie.org> wrote in message
news:OJzDUx9lDHA.3024@.tk2msftngp13.phx.gbl...
> We have a SQL Advance server 2000 running SQL Server 2000 SP3 and has
> Outlook 2002 installed. The SQL Agent runs under the account
> ghs2000\sqlexec.
> I logged into this machine as ghs2000\sqlexec and setup a POP3 account
> on the machine. Tested sending emails and test mails from SQL Server
> and they work fine.
> Now we log into the machine as a different user, it's normally logged in
> as ghs2000\madmin. And we leave Outlook running. But the emails from
> SQL Server never get sent out. They won't get sent out unless we log
> into the server as ghs2000\sqlexec and open Outlook 2002.
> Any way to set this up so the messages are sent out regardless of who is
> logged in? Is this a limitation in Outlook 2002 or would the same thing
> happen in Outlook 2002?
> *** Sent via Developersdex http://www.developersdex.com ***
> Don't just participate in USENET...get rewarded for it!|||I have Outlook 2K setup for a POP3 acct to work with SQL 2K. Honestly it is
painful to have it works. First thing it doesn't work well if I used
Terminal service, so I have to drive all the way at the midnight to the data
center where we keep our servers to logon physically. Then it never work as
expected. Why? Because emails stucked in the Out folder. I have to logon
as the domain acct that starts up SQL services then the mails are sent out.
I do every thing from MS KB. It works on this server but the others.
Finally it works on all servers but I will never know what made SQL mail
failed at the first time. I follow all steps, one by one, per MS KBs. If
it fails I will just start over, recreate the email profile, set up SQL mail
then it will work after second or third time.
>>Any way to set this up so the messages are sent out regardless of who is
>>logged in?
SQL mail is supposed to work that way. It is the way SQL mails is working
on my SQL boxes now.
"Colin Colin" <ccole@.ghs.guthrie.org> wrote in message
news:OJzDUx9lDHA.3024@.tk2msftngp13.phx.gbl...
> We have a SQL Advance server 2000 running SQL Server 2000 SP3 and has
> Outlook 2002 installed. The SQL Agent runs under the account
> ghs2000\sqlexec.
> I logged into this machine as ghs2000\sqlexec and setup a POP3 account
> on the machine. Tested sending emails and test mails from SQL Server
> and they work fine.
> Now we log into the machine as a different user, it's normally logged in
> as ghs2000\madmin. And we leave Outlook running. But the emails from
> SQL Server never get sent out. They won't get sent out unless we log
> into the server as ghs2000\sqlexec and open Outlook 2002.
> Any way to set this up so the messages are sent out regardless of who is
> logged in? Is this a limitation in Outlook 2002 or would the same thing
> happen in Outlook 2002?
> *** Sent via Developersdex http://www.developersdex.com ***
> Don't just participate in USENET...get rewarded for it!sqlsql

Tuesday, March 20, 2012

Conditionally execute a task

Hallo

Is there a way to conditionally execute a task?

I got a task “Mail Send“ and I would like to execute it, just if the variable X (my message source) has a value.

I try in expressions “Disable” = len(@.[Benutzer::Msg] ) > 5 ? false : true, but it does not work.

Link with an an arrow the task before send mail task double click the green line and (you have Precedence Constraint Editor window) choose at Evaluation Operation the value Expression and type

@.x is not null or other expression

so if the expression is true SSIS will go and run sendmail task

|||

Following ggciubuc post...

You can add an additional row to a scrit task in order to fail the package if the expression is the oposite of the first expression...

helped?

Regards

Sunday, March 11, 2012

Conditional Send Mail Task

Hi,

I want send email if certain conditions are met (by send mail task)... if compnay records does not exists in some table (returns null)... not task failure.... how do I achieve this without using Script task?

does any one have an idea about it,

regards

You need conditional workflow: http://www.sqlis.com/default.aspx?306

You can base your expression on a boolean variable that can be set from various places, including a script task.

-Jamie

|||

In contiuation i would like to ask another question i.e. I want to send the results of my query (complete result sets) from email task? How will I able to achieve the task.?

ur help will be appreciated

|||

Zadoras wrote:

In contiuation i would like to ask another question i.e. I want to send the results of my query (complete result sets) from email task? How will I able to achieve the task.?

ur help will be appreciated

Hmmm interesting one. probably the easiest way is to push that data into a flat file destination and then email that file as an attachment.

-Jamie

|||

that's what i was thinking... but i m searching for other way (may be the easiest way)

BTW... thanx for your support

if ne one come across to ne better idea than that please let me know