MSDN: Am I missing something?
-
When-ever I write a function to send an email, I'll be sure to make it take the server as a parameter, rather than store it in my config, but I'll be sure to hard code the message and the person to send it to. The sad thing is, there are places where people look to the MSDN for examples of how best to write real world code. Just like there were folks who used CArray instead of std::vector because they 'were Microsoft shops'.
Christian Graus - Microsoft MVP - C++ "also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
Christian Graus wrote:
Just like there were folks who used CArray instead of std::vector because they 'were Microsoft shops'.
CArray vs VC++ std::vector: I will use CArray anytime. In fact even now I prefer CArray because all the STL classes emit too many errors in boundschecker. Now STLPort is a different matter.
Co-Author ASP.NET AJAX in Action CP Quote of the Day: It is the same Friday that blooms as a new enriching day with novelty and innovation for us every week. - Vasudevan Deepak Kumar
-
From the MSDN Docs "The following code example demonstrates accessing the ServicePoint property."
public static void CreateTestMessage1(string server, int port)
{
string to = "jane@contoso.com";
string from = "ben@contoso.com";
string subject = "Using the new SMTP client.";
string body = @"Using this new feature, you can send an e-mail message from an application very easily.";
MailMessage message = new MailMessage(from, to, subject, body);
SmtpClient client = new SmtpClient(server, port);
// Credentials are necessary if the server requires the client
// to authenticate before it will send e-mail on the client's behalf.
client.Credentials = CredentialCache.DefaultNetworkCredentials;client.Send(message);
}
Um...does it?
cheers, Chris Maunder
CodeProject.com : C++ MVP
Chris Maunder wrote:
Um...does it?
I've recently discovered that when I see something like that but I don't see an example, or an example that seems oddly wrong, to click on the "show VB code" and more often than not, voila, the example, in :sigh: VB. Because, usually, I've set the filter to show only C# language examples! ;) Marc
-
Christian Graus wrote:
Just like there were folks who used CArray instead of std::vector because they 'were Microsoft shops'.
CArray vs VC++ std::vector: I will use CArray anytime. In fact even now I prefer CArray because all the STL classes emit too many errors in boundschecker. Now STLPort is a different matter.
Co-Author ASP.NET AJAX in Action CP Quote of the Day: It is the same Friday that blooms as a new enriching day with novelty and innovation for us every week. - Vasudevan Deepak Kumar
If you're using VC6, apart from the fact that you're in the dark ages, which has major repercussions especially if you are trying to write good C++, you'd be insane not to install a different version of STL.
Christian Graus - Microsoft MVP - C++ "also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
-
If you're using VC6, apart from the fact that you're in the dark ages, which has major repercussions especially if you are trying to write good C++, you'd be insane not to install a different version of STL.
Christian Graus - Microsoft MVP - C++ "also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
Christian Graus wrote:
If you're using VC6, apart from the fact that you're in the dark ages,
Welcome to 80% of the companies I've worked for. 80% also use Visual Source Safe 6.0 as their CVS!
Never argue with an imbecile; they bring you down to their level, and beat you with experience. Blog
-
From the MSDN Docs "The following code example demonstrates accessing the ServicePoint property."
public static void CreateTestMessage1(string server, int port)
{
string to = "jane@contoso.com";
string from = "ben@contoso.com";
string subject = "Using the new SMTP client.";
string body = @"Using this new feature, you can send an e-mail message from an application very easily.";
MailMessage message = new MailMessage(from, to, subject, body);
SmtpClient client = new SmtpClient(server, port);
// Credentials are necessary if the server requires the client
// to authenticate before it will send e-mail on the client's behalf.
client.Credentials = CredentialCache.DefaultNetworkCredentials;client.Send(message);
}
Um...does it?
cheers, Chris Maunder
CodeProject.com : C++ MVP
-
From the MSDN Docs "The following code example demonstrates accessing the ServicePoint property."
public static void CreateTestMessage1(string server, int port)
{
string to = "jane@contoso.com";
string from = "ben@contoso.com";
string subject = "Using the new SMTP client.";
string body = @"Using this new feature, you can send an e-mail message from an application very easily.";
MailMessage message = new MailMessage(from, to, subject, body);
SmtpClient client = new SmtpClient(server, port);
// Credentials are necessary if the server requires the client
// to authenticate before it will send e-mail on the client's behalf.
client.Credentials = CredentialCache.DefaultNetworkCredentials;client.Send(message);
}
Um...does it?
cheers, Chris Maunder
CodeProject.com : C++ MVP
-
From the MSDN Docs "The following code example demonstrates accessing the ServicePoint property."
public static void CreateTestMessage1(string server, int port)
{
string to = "jane@contoso.com";
string from = "ben@contoso.com";
string subject = "Using the new SMTP client.";
string body = @"Using this new feature, you can send an e-mail message from an application very easily.";
MailMessage message = new MailMessage(from, to, subject, body);
SmtpClient client = new SmtpClient(server, port);
// Credentials are necessary if the server requires the client
// to authenticate before it will send e-mail on the client's behalf.
client.Credentials = CredentialCache.DefaultNetworkCredentials;client.Send(message);
}
Um...does it?
cheers, Chris Maunder
CodeProject.com : C++ MVP
The VS2008 / .NET 3.5 page[^] has a very simple example in both C++ and J#, but the C# example is still the same.
"These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer
-
Chris Maunder wrote:
Um...does it?
I've recently discovered that when I see something like that but I don't see an example, or an example that seems oddly wrong, to click on the "show VB code" and more often than not, voila, the example, in :sigh: VB. Because, usually, I've set the filter to show only C# language examples! ;) Marc
A year or two ago MS blogged that they were writing the VB samples first and others later as time permitted. IT had something to do with VB coders being far less likely to be able to use an example in a C style language than the reverse. :rolleyes:
-- Join the Campaign to Help Stamp Out and Abolish Redundancy The preceding is courtesy of the Bureau of Unnecessarily Redundant Repetition Department.
-
wrote:
Um...does it?
Yup. Ain't .NET great? You access important stuff without ever actually referencing it.
Like how
Application.Run(Form1)
gives you a full-fledged application.ROFLOLMFAO
-
From the MSDN Docs "The following code example demonstrates accessing the ServicePoint property."
public static void CreateTestMessage1(string server, int port)
{
string to = "jane@contoso.com";
string from = "ben@contoso.com";
string subject = "Using the new SMTP client.";
string body = @"Using this new feature, you can send an e-mail message from an application very easily.";
MailMessage message = new MailMessage(from, to, subject, body);
SmtpClient client = new SmtpClient(server, port);
// Credentials are necessary if the server requires the client
// to authenticate before it will send e-mail on the client's behalf.
client.Credentials = CredentialCache.DefaultNetworkCredentials;client.Send(message);
}
Um...does it?
cheers, Chris Maunder
CodeProject.com : C++ MVP
Looks kind of like System.Net.Mail to me...
-Adam N. Thompson