Hello,I have a package that's working perfectly inside my company's domain. The package reads a string of e-mail addresses from a database and passes those on to a foreach loop that contains a script task which sends e-mail to all internal e-mail addresses only. Here is the script in the script task:using System;using System.Net;using System.Net.Mail;using System.Data;using Microsoft.SqlServer.Dts.Runtime;using System.Windows.Forms;public void Main() { MessageBox.Show(Dts.Variables["strEmail"].Value.ToString()); string htmlMessageTo = Dts.Variables["HtmlEmailFrom"].Value.ToString(); string htmlMessageFrom = Dts.Variables["strEmail"].Value.ToString(); string htmlMessageSubject = Dts.Variables["HtmlEmailSubject"].Value.ToString(); string htmlMessageBody = Dts.Variables["HtmlEmailBody"].Value.ToString(); string smtpServer = Dts.Variables["HtmlEmailServer"].Value.ToString(); SendMailMessage(htmlMessageTo, htmlMessageFrom, htmlMessageSubject, htmlMessageBody, true, smtpServer); Dts.TaskResult = (int)ScriptResults.Success; } private void SendMailMessage(string SendTo, string From, string Subject, string Body, bool IsBodyHtml, string Server) { MailMessage htmlMessage; SmtpClient mySmtpClient; MessageBox.Show("To:" + SendTo); MessageBox.Show("From:" + From); MessageBox.Show("Subject:" + Subject); MessageBox.Show("Body:" + Body); htmlMessage = new MailMessage(SendTo, From, Subject, Body); htmlMessage.IsBodyHtml = IsBodyHtml; mySmtpClient = new SmtpClient(Server); //mySmtpClient.Credentials = CredentialCache.DefaultNetworkCredentials; mySmtpClient.Send(htmlMessage); } }}
Sending this to a yahoo account returns an error e-mail that gives no details. It merely lists the e-mail address and says "An error occurred while trying to deliver this message to the recipient's e-mail address. Microsoft Exchange will not try to redeliver this message for you. Please try resending this message, or provide the following diagnostic text to your system administrator.The following organization rejected your message: Requested."Another bizarre thing: I had to switch the From and To variables around in order for this to work correctly.So, could this be a problem with SMTP Credentials? I haven't tried this with an SMTP connection manager yet, so maybe that's the issue?Thank you!!Ed Womackwww.getmilked.com