how to send mail in C#

G

Guest

I use this code :

MailMessage mail = new MailMessage();
mail.From = FromAddress;
mail.To = MailAddress;
mail.Subject = Subject;
mail.Body = MessageText;
mail.BodyFormat = MailFormat.Html;
if(XmlAttachmentPath.Length !=0)
{
MailAttachment csiAttachment = new MailAttachment(XmlAttachmentPath);
mail.Attachments.Add(csiAttachment);
}

SmtpMail.SmtpServer= oursmtpservername
SmtpMail.Send(mail);


This works well when I pass addresses of our emailids containitn our domain
name
when I try sending mails to other than our domain ids. say yahoo or msn it
gives me cdo.ojbect error.

How do i send mails then to other domain ids.

Help me

Thanks.
 
S

Sam Martin

so it works for local addresses, i.e. mailboxes on your local domain(s)? but
not external?
i would check your SMTP server's relaying options.

unless someone actually knows what the problem is :)

HTH
sam
 
B

bowman

Venkat said:
How do i send mails then to other domain ids.

Is your local SMTP server set up to relay? Does it require authentication to
allow relaying? I assume your usual mail client allows you to send outside
the local net? Depending on how your system administrator has set it up,
your email client may work because it has done a POP3 authentication before
attempting to send.

Is your local server ESMTP? You can query for the AUTH methods it supports.

If the local server is attempting to send, does it allow a reverse DNS
lookup? If the yahoo server considers it unverifiable, it will not accept.

Can you go directly to the yahoo server? That will require authentication,
so you'll need an account with username/password.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top