473,408 Members | 2,087 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,408 software developers and data experts.

how to send mail in C#

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.
Nov 16 '05 #1
2 2006
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

"Venkat" <Ve****@discussions.microsoft.com> wrote in message
news:EB**********************************@microsof t.com...
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.

Nov 16 '05 #2
Venkat wrote:

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.
Nov 16 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

15
by: Steve Horrillo | last post by:
I can't figure out why this script won't insert the subject in the email and why can't I control the font and size being used? I'm not sure where to post this. Let me know where if this is OT. ...
6
by: DigitalRick | last post by:
I have been running CDONTS in my ASPpages to send emails to me sent from my guestbook. It had been working fine untill I upgraded to Server 2003 (I am also running Exchange 2003) all locally. I...
6
by: John J. Hughes II | last post by:
I have a service that needs to send e-mail alerts. I have been attempting to use the System.Net.Mail function from .NET but this seems to require the IIS be installed and running. Since some of...
1
by: Jens Øster | last post by:
Hi I am writing a ASP.NET web application that must sent some e-mails. I get the exception “Could not access 'CDO.Message' object” when I call SmtpMail.Send. This only happens when I send...
3
by: Jens | last post by:
Hi I am writing a ASP.NET web application that must sent some e-mails. I get the exception “Could not access 'CDO.Message' object” when I call SmtpMail.Send. This only happens when I send...
3
by: RN | last post by:
I am tired of sending mail from the built-in SMTP service for so many reasons (errors are nondescriptive in the event log, it doesn't let me control which IP address it sends from, and it...
3
by: Gerard | last post by:
Hello I have created a windows service to monitor a database, it starts some checks when a timer elapses. The checks send emails depending on their findings. My issue is that when I created a...
14
by: supz | last post by:
Hi, I use the standard code given below to send an email from an ASP.NET web form. The code executes fine but no Email is sent. All emails get queued in the Inetpub mail queue. I'm using my...
15
by: cj | last post by:
How can I get a button in VB to send the contents of a text box via email in a manner similar to the "Send To\Mail Recipient" functionality that you can select via right clicking a file in Windows...
4
by: =?Utf-8?B?dHBhcmtzNjk=?= | last post by:
I have a web page that at the click of a button must send a bunch (1000+) emails. Each email is sent individually. I have the code working fine, using Mail Message classes and smtp and all that. ...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development projectplanning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.