473,386 Members | 1,798 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,386 software developers and data experts.

sending mails

hi,every one!
I have a question about sending emails.My codes works well over some smtp
servers,but doesn't over the others. My codes is listed belowed:
try
{
MailMessage mailObj = new MailMessage();
mailObj.To.Add(receipientAddr);
mailObj.From = new MailAddress(senderAddr);

mailObj.Subject = "very good";
mailObj.Body = "thank you";

mailObj.IsBodyHtml = true;
mailObj.Priority = MailPriority.High;
mailObj.BodyEncoding = System.Text.Encoding.UTF8;
System.Net.Mail.SmtpClient client = new
System.Net.Mail.SmtpClient(smtpServerIP);
client.UseDefaultCredentials = false;
mailObj.SubjectEncoding = System.Text.Encoding.UTF8;
client.Credentials = new
System.Net.NetworkCredential(this.tb_mailUserName. Text,
this.tb_mailUserPassword.Text);
client.DeliveryMethod = SmtpDeliveryMethod.Network;
client.Send(mailObj);

}
catch(Exception ex)
{
MessageBox.Show(ex.Message.ToString());
return;
}

when smtpServerIP is specified with some smtp server ips, the mail can be
delievered correctly.But over some smtp servers such as "smtp.21cn.com",the
codes didn't throw any exception and seemed to have work well,but when I
logined mail.21cn.com,I could not find the expectedly incoming mail. Could
anyone help me?

Crespo
2006-07-03

Jul 4 '06 #1
4 2117
when smtpServerIP is specified with some smtp server ips, the mail can be
delievered correctly.But over some smtp servers such as "smtp.21cn.com",the
codes didn't throw any exception and seemed to have work well,but when I
logined mail.21cn.com,I could not find the expectedly incoming mail. Could
anyone help me?
Do you mean that mail is not being delivered if you use the DNS name,
but it is if you use the IP address? Or do you mean that some servers,
with no discernable pattern among them, simply aren't showing the emails
you're sending them?

If the former, check the DNS settings on the machine that's running the
code. I once encountered this problem on a web server where everything
was done by IP, and the DNS had never been configured.

If the latter, could it be that the mail server in question is filtering
the message as spam? HTML formatted, high priority, fewer than 10 bytes
of body text... could get flagged. Also, maybe that server is quietly
refusing to relay your message? Is the machine that's running the code
just some random host on the internet, from the perspective of that mail
server? It might only accept mail from "more reputable" hosts.

In terms of the MTA on that server, there could be plenty of reasons why
it's not accepting the message. If it thinks you're spam or trying to
improperly relay through it, it'll likely just ignore the message. If
there's a real error happening on their end, it should return a failure
message to whatever "senderAddr" is set to in your code (hopefully a
real email address).
Regards,
David P. Donahue
dd******@ccs.neu.edu
http://www.cyber0ne.com
Jul 4 '06 #2
Zeeway,

This is the kind of thing where you have to have access to the server.
Also, what is the return address that you are placing in the email? Are you
getting anything at that return address indicating that the email was
invalid?

The SMTP mail classes are only going to throw an exception if there is a
transport problem, or if the server gives a response indicating that the
email is not accepted.

However, a server doesn't have to tell you that it rejected your message
when you send it. It will usually send a return message to the reply
address.

So I recommend you have the reply address set to an account you can
monitor, and then see what the server sends back to you. Either that, or
contact the mail admin at the server you are sending the mail to, and see if
that person can help you.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Zeeway" <ze****@gmail.comwrote in message
news:OV***************@TK2MSFTNGP03.phx.gbl...
hi,every one!
I have a question about sending emails.My codes works well over some smtp
servers,but doesn't over the others. My codes is listed belowed:
try
{
MailMessage mailObj = new MailMessage();
mailObj.To.Add(receipientAddr);
mailObj.From = new MailAddress(senderAddr);

mailObj.Subject = "very good";
mailObj.Body = "thank you";

mailObj.IsBodyHtml = true;
mailObj.Priority = MailPriority.High;
mailObj.BodyEncoding = System.Text.Encoding.UTF8;
System.Net.Mail.SmtpClient client = new
System.Net.Mail.SmtpClient(smtpServerIP);
client.UseDefaultCredentials = false;
mailObj.SubjectEncoding = System.Text.Encoding.UTF8;
client.Credentials = new
System.Net.NetworkCredential(this.tb_mailUserName. Text,
this.tb_mailUserPassword.Text);
client.DeliveryMethod = SmtpDeliveryMethod.Network;
client.Send(mailObj);

}
catch(Exception ex)
{
MessageBox.Show(ex.Message.ToString());
return;
}

when smtpServerIP is specified with some smtp server ips, the mail can
be
delievered correctly.But over some smtp servers such as
"smtp.21cn.com",the
codes didn't throw any exception and seemed to have work well,but when I
logined mail.21cn.com,I could not find the expectedly incoming mail.
Could
anyone help me?

Crespo
2006-07-03

Jul 4 '06 #3
Thanks for your attention. Following your advice,I specify a replyTo mail
address,but it still doesn't do the trick.
But thank you anyway.
Best Wishes

Crespo
"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard.caspershouse.comдÈëÏûÏ¢
news:uI**************@TK2MSFTNGP05.phx.gbl...
Zeeway,

This is the kind of thing where you have to have access to the server.
Also, what is the return address that you are placing in the email? Are
you
getting anything at that return address indicating that the email was
invalid?

The SMTP mail classes are only going to throw an exception if there is
a
transport problem, or if the server gives a response indicating that the
email is not accepted.

However, a server doesn't have to tell you that it rejected your
message
when you send it. It will usually send a return message to the reply
address.

So I recommend you have the reply address set to an account you can
monitor, and then see what the server sends back to you. Either that, or
contact the mail admin at the server you are sending the mail to, and see
if
that person can help you.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Zeeway" <ze****@gmail.comwrote in message
news:OV***************@TK2MSFTNGP03.phx.gbl...
hi,every one!
I have a question about sending emails.My codes works well over some
smtp
servers,but doesn't over the others. My codes is listed belowed:
try
{
MailMessage mailObj = new MailMessage();
mailObj.To.Add(receipientAddr);
mailObj.From = new MailAddress(senderAddr);

mailObj.Subject = "very good";
mailObj.Body = "thank you";

mailObj.IsBodyHtml = true;
mailObj.Priority = MailPriority.High;
mailObj.BodyEncoding = System.Text.Encoding.UTF8;
System.Net.Mail.SmtpClient client = new
System.Net.Mail.SmtpClient(smtpServerIP);
client.UseDefaultCredentials = false;
mailObj.SubjectEncoding = System.Text.Encoding.UTF8;
client.Credentials = new
System.Net.NetworkCredential(this.tb_mailUserName. Text,
this.tb_mailUserPassword.Text);
client.DeliveryMethod = SmtpDeliveryMethod.Network;
client.Send(mailObj);

}
catch(Exception ex)
{
MessageBox.Show(ex.Message.ToString());
return;
}

when smtpServerIP is specified with some smtp server ips, the mail can
be
delievered correctly.But over some smtp servers such as
"smtp.21cn.com",the
codes didn't throw any exception and seemed to have work well,but when I
logined mail.21cn.com,I could not find the expectedly incoming mail.
Could
anyone help me?

Crespo
2006-07-03



Jul 5 '06 #4

Because different smtp servers uses different authentication models.

http://sholliday.spaces.live.com/
2/8/2006 entry

I have 1.1 and 2.0 downloadable code to show the differences.


"Zeeway" <ze****@gmail.comwrote in message
news:Oz**************@TK2MSFTNGP04.phx.gbl...
Thanks for your attention. Following your advice,I specify a replyTo mail
address,but it still doesn't do the trick.
But thank you anyway.
Best Wishes

Crespo
"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard.caspershouse.com>
дÈëÏûÏ¢
news:uI**************@TK2MSFTNGP05.phx.gbl...
Zeeway,

This is the kind of thing where you have to have access to the
server.
Also, what is the return address that you are placing in the email? Are
you
getting anything at that return address indicating that the email was
invalid?

The SMTP mail classes are only going to throw an exception if there
is
a
transport problem, or if the server gives a response indicating that the
email is not accepted.

However, a server doesn't have to tell you that it rejected your
message
when you send it. It will usually send a return message to the reply
address.

So I recommend you have the reply address set to an account you can
monitor, and then see what the server sends back to you. Either that,
or
contact the mail admin at the server you are sending the mail to, and
see
if
that person can help you.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Zeeway" <ze****@gmail.comwrote in message
news:OV***************@TK2MSFTNGP03.phx.gbl...
hi,every one!
I have a question about sending emails.My codes works well over some
smtp
servers,but doesn't over the others. My codes is listed belowed:
try
{
MailMessage mailObj = new MailMessage();
mailObj.To.Add(receipientAddr);
mailObj.From = new MailAddress(senderAddr);
>
mailObj.Subject = "very good";
mailObj.Body = "thank you";
>
mailObj.IsBodyHtml = true;
mailObj.Priority = MailPriority.High;
mailObj.BodyEncoding = System.Text.Encoding.UTF8;
>
>
System.Net.Mail.SmtpClient client = new
System.Net.Mail.SmtpClient(smtpServerIP);
client.UseDefaultCredentials = false;
mailObj.SubjectEncoding = System.Text.Encoding.UTF8;
client.Credentials = new
System.Net.NetworkCredential(this.tb_mailUserName. Text,
this.tb_mailUserPassword.Text);
client.DeliveryMethod = SmtpDeliveryMethod.Network;
client.Send(mailObj);
>
}
catch(Exception ex)
{
MessageBox.Show(ex.Message.ToString());
return;
}
>
when smtpServerIP is specified with some smtp server ips, the mail
can
be
delievered correctly.But over some smtp servers such as
"smtp.21cn.com",the
codes didn't throw any exception and seemed to have work well,but when
I
logined mail.21cn.com,I could not find the expectedly incoming mail.
Could
anyone help me?
>
Crespo
2006-07-03
>
>
>


Aug 30 '06 #5

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

Similar topics

10
by: Stuart Mueller | last post by:
I have an exchange server, that I sometimes use to perform mail shots to clients on our database, these can be upwards of 1000 at a time. As we don't want different clients to see who we are...
3
by: martin smith | last post by:
Here's the scenario. I'm currently using cdosys/asp to send mail to our SMTP server. We use a product called MailFilter to check for SPAM. It doesn't work very well. If MailFilter isn't working...
1
by: Jayakumar | last post by:
HI, I am using System.web.mail class in my application to send mails. I am using SMTP server for the same. I can send mail to the intranet addresses, But when i send mails to Hotmail or other...
7
by: Lau | last post by:
I need to send 1000 emails from an asp.net website. Normally I would use System.Web.Mail.MailMessage() to send thru an SMTP server. But the large amount of emails results in a timeout. My server...
5
by: cashdeskmac | last post by:
I am writing a web application will will be hosted on a few peoples laptops as a local application. It will send e-mails once the user connects to the internet. How can I set up the "Mail.From"...
1
by: Dirk Goossens | last post by:
Hello! I'm sending E-mails to mailadresses in a table, using the code below. How can I send more than one attachment? Access can find the file to be send in this field: MY_EMAILATTACHMENT_FIELD...
8
by: Michel Posseth [MCP] | last post by:
Hi does someone has experience with this ?? i have made a lot of apps in the past that were capable of sending e-mails the server i then talked to was a Linux SMTP server and it worked great ...
1
by: gemma.gill | last post by:
Hi There, I have a button on a form within access that sends a verification e- mail. My problem is that these e-mails are sending from individual user accounts rather than a genieric mailbox. ...
3
by: dskinibbyb | last post by:
Hi Everybody, I am sending mail using the new class in .Net 2.0. Here while sending internal mails it is giving me problem. Carriage return, Line feed and Spaces are lost while sending mails....
2
by: srinivaspnv21 | last post by:
hi every one, plz help me out, i have to send mails from my asp.net page.... I have tried a code where mails are going only to gmail users the code is ... namespace: using System.Web.Mail;...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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: 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
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
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
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.