We recently upgraded from Exchange 03 to Exchange 07 and now the "Send Email" action will no longer work. I get the following log:
3/5/2009 8:01:35 AM : 220 xxxxxxxxxxxxxx Microsoft ESMTP MAIL Service ready at Thu, 5 Mar 2009 09:01:35 -0500
3/5/2009 8:01:35 AM : 250-xxxxxxxxxxxxxx Hello [172.29.3.61]250-SIZE250-PIPELINING250-DSN250-ENHANCEDSTATUSCODES250-X-ANONYMOUSTLS250-AUTH NTLM250-X-EXPS GSSAPI NTLM250-8BITMIME250-BINARYMIME250-CHUNKING250-XEXCH50250 XRDST
3/5/2009 8:01:35 AM : 221 2.0.0 Service closing transmission channel
Disconnected. : Disconnected.
System Enviorment:
Windows 2003 R2 Standard, WIndows Firewall Disabled, Symantec Antivirus Installed but Firewall component is not.
So, I put on my programmer hat and wrote a C# application to do the same thing (to make sure it wasn't the machine). This code executes just fine on the machine. Emails go right thru to the Exchange server no problem, so it has to be a problem with FinalBuilder.
using System;
using System.Net;
using System.Net.Mail;
using System.Net.Mime;
using System.Text;
namespace SmtpMail
{
class Program
{
static void Main(string[] args)
{
try
{
SendMail("Your TPS reports are done!", DateTime.Now.ToLongTimeString(), null);
}
catch (Exception ex)
{
Console.WriteLine(ex);
}
}
///
///
///
///
Subject of the email.
///Body of the email
///Full path to the attachment.
private static void SendMail(string subject, string body, string pathToAttachment)
{
try
{
//create a new from mail address.
var from = new MailAddress("Peter.Gibbons@Initech.com");
//create a new recepient mail address.
var to = new MailAddress("Bill.Lumbergh@Initech.com");
//create a new email message.
var mailMessage = new MailMessage(from, to);
//create a smtp client
var client = new SmtpClient("smtp.Initech.com", 25);
//set the network credentials.
client.Credentials = new NetworkCredential("user", "password", "domain");
//set the subject.
mailMessage.Subject = subject;
//set the body of the email.
mailMessage.Body = body;
//set the email to be text.
mailMessage.IsBodyHtml = false;
//set the default endoding
mailMessage.BodyEncoding = Encoding.Default;
try
{
var data = new Attachment(pathToAttachment, MediaTypeNames.Application.Octet);
ContentDisposition disposition = data.ContentDisposition;
disposition.CreationDate = System.IO.File.GetCreationTime(pathToAttachment);
disposition.ModificationDate = System.IO.File.GetLastWriteTime(pathToAttachment);
disposition.ReadDate = System.IO.File.GetLastAccessTime(pathToAttachment);
mailMessage.Attachments.Add(data);
}
catch (Exception)
{
//just ignore it...file probably does not exist.
}
//disable ssl
client.EnableSsl = false;
//finally, send the message.
client.Send(mailMessage);
}
catch (Exception ex)
{
//log any messages to the console window.
Console.WriteLine(ex);
}
}
}
}
Does anyone have any idea why this maybe occuring? This has stopped us dead in our tracks.