>>>>>>>>Hi,
>>>>>>>>
>>>>>>>>I'm using VS2008 and C# (what version of C# is that?) and need to send an email with an attachment from my ASP.NET solution.
>>>>>>>>
>>>>>>>>I've recently started using Blat.dll in VFP and find it nice and easy to use, should I use it in my .NET stuff or should I use MailMessage()
>>>>>>>>
>>>>>>>>If using blat, does anyone have some example code?
>>>>>>>
>>>>>>>I've never used Blat but, FWIW, I have a simple assembly using the System.Net.Mail .MailMessage and .SmtpClient classes. I've plugged it in to various applications for various clients over the years and have yet to encounter any problems.......
>>>>>>
>>>>>>
>>>>>>Thanks Viv,
>>>>>>
>>>>>>could you share your code, please?
>>>>>
>>>>>Just looked at it. It is so embarrassingly crude (cobbled together at least five years ago on the spur of the moment and never revisited) that I think I'll just PM it to you :-}
>>>>
>>>>Thanks, I'm sure it won't be as crude as what I have come up with :)
>>>
>>>Wanna bet ? Anyone it is on it's way.....
>>
>>Thanks Viv!
>
>The core of it boils down to this:
System.Net.Mail.SmtpClient mailclient = new System.Net.Mail.SmtpClient("ServerName");
> mailclient.Credentials = new System.Net.NetworkCredential("UserName", "Password");
>
> System.Net.Mail.MailMessage msg = new System.Net.Mail.MailMessage("SendersAddress","RecipientsAddress");
> msg.Subject = "Message Subject";
> msg.Body = "This is the body of the message";
>
> mailclient.Send(msg);
There are bits to add names to the send list, add attachments etc but.......
Thanks Viv,
I have that working already, was just trying to understand Bill's code to see if it was any simpler.