SSIS package displays an error when I use send mai

2019-09-05 14:20发布

I have a package with a task used SEND MAIL Task, but its executing fine till it approach to send mail task and display an error. Which is [Send Mail Task] Error: An error occurred with the following error message: "Syntax error, command unrecognized. The server response was: 5.0.0 Your email system must authenticate before sending mail

标签: sql ssis
1条回答
太酷不给撩
2楼-- · 2019-09-05 14:44

The mail server you're trying to use requires authentication before it will receive messages.

SSIS's SMTP connection manager is limited to supporting Windows authentication. This form of authentication might work if you were using a Windows-based mail server internal to your network (say, a Microsoft Exchange Server). However, it sounds like your server requires authentication with a username and password. SSIS doesn't support this out of the box.

Options that might work in your situation:

  • Ask your mail server operator to white list your SSIS server's IP address so that the mail server doesn't require authentication when messages are received from that IP. This option allows you to use SSIS's built-in Send Mail Task.
  • Set up a SMTP relay server on your SSIS server. Configure the relay to only accept local connections (preventing other computers from sending SPAM through your system) and to forward all messages to the external SMTP server you want to use. (Of course, the relay needs to support authenticating with the remote SMTP server.) This option also allows you to keep using SSIS's built-in Send Mail Task.
  • As @Justin mentions, create a script task that does the sending. You could use .Net's SmtpClient class, which supports username/password authentication, to send the message.
  • Use a third-party SSIS component. I've not tried any so I can't make recommendation but searching for "ssis smtp component" turned up options.
  • If you have access to a Microsoft SQL Server, using an Execute SQL Task that calls sp_send_dbmail might work. SQL Server's Database Mail supports basic authentication and SSL.
查看更多
登录 后发表回答