January 26, 2012

Send Email - C#

SmtpClient myYahoo = new SmtpClient();
MailMessage myMessage = new MailMessage();

myYahoo.Host = Dts.Variables["smtpHost"].Value.ToString();
myYahoo.Port = (int)Dts.Variables["smtpPort"].Value.ToString(); // 587;
myYahoo.EnableSsl = true; // Yahoo doesn't need this one but gmail.

myMessage.From = new MailAddress(Dts.Variables["smtpFrom"].Value.ToString(), Dts.Variables["smtpName"].Value.ToString());
myMessage.To.Add(Dts.Variables["smtpTo"].Value.ToString());
myMessage.Subject = Dts.Variables["smtpSubject"].Value.ToString();
myMessage.Body = Dts.Variables["smtpBody"].Value.ToString();
NetworkCredential myCreds = new NetworkCredential(Dts.Variables["smtpTo"].Value.ToString(), Dts.Variables["smtpPassword"].Value.ToString());

myYahoo.Credentials = myCreds;
try
{
myYahoo.Send(myMessage);
}
catch (Exception ex)
{
throw new Exception("New Error: " + ex.ToString());
}

January 03, 2012

Detect CDN jQuery non accessible by loading from local jQuery instead