R
Robert Salasidis
I am trying to get an email application working in ASP.Net
I was trying to use a remote SMTP server (on my web site - but hosted
by a third party), but was constantly getting the 'Could not access
'CDO.Message' Object ' message.
I tried all teh suggestions I could find on Google, ut was unable to
get it to work.
In the end I decided to use my local host (using my local IP address.
The program completes as expected, no exceptions are thrown.
the problem is that all my emails are ending up in the
\Inetpub\mailroot\Queue directory on my local computer (running the
SMTP server)
The sizes of the emails are accurate.
Any ideas?
the relevant code is listed below
for(;(readStr = srEmail.ReadLine()) != null; )
{
try
{
try
{
MailMessage Message = new MailMessage();
Message.To = readStr;
Message.From = EmailAccountTextBox.Text;
Message.Subject = SubjectTextBox.Text;
Message.Body = htmlString;
foreach (string s1 in attachmentStrings)
{
MailAttachment myAttachment = new
MailAttachment(s1, MailEncoding.Base64);
Message.Attachments.Add(myAttachment);
}
try
{
// SmtpMail.SmtpServer =
SMTPServerTextBox.Text;
SmtpMail.SmtpServer = "192.168.0.5";
// SmtpMail.SmtpServer =
"216.119.106.22";
SmtpMail.Send(Message);
}
catch(System.Web.HttpException ehttp)
{
SendingLabel.Text = "Error Sending
Email - " + readStr + " Message - " + ehttp.ToString();
break;
}
}
catch(IndexOutOfRangeException)
{
}
}
I was trying to use a remote SMTP server (on my web site - but hosted
by a third party), but was constantly getting the 'Could not access
'CDO.Message' Object ' message.
I tried all teh suggestions I could find on Google, ut was unable to
get it to work.
In the end I decided to use my local host (using my local IP address.
The program completes as expected, no exceptions are thrown.
the problem is that all my emails are ending up in the
\Inetpub\mailroot\Queue directory on my local computer (running the
SMTP server)
The sizes of the emails are accurate.
Any ideas?
the relevant code is listed below
for(;(readStr = srEmail.ReadLine()) != null; )
{
try
{
try
{
MailMessage Message = new MailMessage();
Message.To = readStr;
Message.From = EmailAccountTextBox.Text;
Message.Subject = SubjectTextBox.Text;
Message.Body = htmlString;
foreach (string s1 in attachmentStrings)
{
MailAttachment myAttachment = new
MailAttachment(s1, MailEncoding.Base64);
Message.Attachments.Add(myAttachment);
}
try
{
// SmtpMail.SmtpServer =
SMTPServerTextBox.Text;
SmtpMail.SmtpServer = "192.168.0.5";
// SmtpMail.SmtpServer =
"216.119.106.22";
SmtpMail.Send(Message);
}
catch(System.Web.HttpException ehttp)
{
SendingLabel.Text = "Error Sending
Email - " + readStr + " Message - " + ehttp.ToString();
break;
}
}
catch(IndexOutOfRangeException)
{
}
}