Re: System.Net.Mail.SmtpClient MailClient message. How do u know if it was successful?
- From: "sloan" <sloan@xxxxxxxxx>
- Date: Wed, 24 Oct 2007 11:27:14 -0400
Go here and download the source code.
http://sholliday.spaces.live.com/Blog/cns!A68482B9628A842A!138.entry
Try to use other things like gmail or even your home isp.... as experiments.
But the source code will show you other options associated with the mail
object.
Both 1.1 and 2.0 samples are provided.
If you find a resolution, please post it.
if (Sender == "") return;
if (Recipient == "") return;
i'd throw an exception here, else you have no idea it didn't work.
if (string.IsNullOrEmpty ( Sender))
{
throw new ArgumentNullException ( "No Sender Supplied") ; //
}
OT
Here is a good link to exceptional handling:
http://blogs.msdn.com/kcwalina/archive/2005/03/16/396787.aspx
"Claire" <cc@xxxxxxxxxx> wrote in message
news:%23CnP68kFIHA.4228@xxxxxxxxxxxxxxxxxxxxxxx
I'm a noob at emailing from code and I need to add email capabilities to
my application.
The following code completes without exceptions but I'm not receiving any
test emails.
How do you debug this? Ive checked my bad mail folder, and other IIS
similar folders and they're empty.
Can the mail classes be used without having a SMTP server running on
localhost? Can you use any smtp server that's capable of being set up from
a PC, e.g. an ISP account?
If so, do you need to obtain the settings that you might find in an
outlook express email server tab?
Does the MailClient accept all the possible settings via properties?
Are there any recommended freeware/opensource SMTP server .net controls
out there that I could plug into my application so I don't have to require
the user to do any configuration?
thank you
Claire
public void SendEmail(string Sender, string Recipient, string Subject,
string Body)
{
string fnName = "SendEmail";
try
{
if (Sender == "") return;
if (Recipient == "") return;
System.Net.Mail.MailMessage Message = new
System.Net.Mail.MailMessage(Sender,Recipient,Subject,Body);
System.Net.Mail.SmtpClient MailClient = new System.Net.Mail.SmtpClient();
MailClient.Host = "LocalHost";
MailClient.Send(Message);
}
catch (Exception e)
{
LogException(fnName, e);
throw e;
}
}// function
.
- References:
- Prev by Date: Re: Limitations on a bound datagrid
- Next by Date: EntLibConfig.exe - Strong name
- Previous by thread: System.Net.Mail.SmtpClient MailClient message. How do u know if it was successful?
- Next by thread: Re: System.Net.Mail.SmtpClient MailClient message. How do u know if it was successful?
- Index(es):
Relevant Pages
|