This works with a legit user running it. It will need a using statement
but your IDE will help you and put it in.
void sendEmail(string strFrom
, string strTo
, string strSubject
, string strBody)
{
MailMessage objMailMessage = new MailMessage();
System.Net.NetworkCredential objSMTPUserInfo =
new System.Net.NetworkCredential();
SmtpClient objSmtpClient = new SmtpClient();
try
{
objMailMessage.From = new MailAddress(strFrom);
objMailMessage.To.Add(new MailAddress(strTo));
objMailMessage.Subject = strSubject;
objMailMessage.Body = strBody;
objSmtpClient = new SmtpClient("172.0.0.1"); /// Server IP
objSMTPUserInfo = new System.Net.NetworkCredential
("User name", "Password","Domain");
objSmtpClient.Credentials = objSMTPUserInfo;
objSmtpClient.UseDefaultCredentials = false;
objSmtpClient.DeliveryMethod = SmtpDeliveryMethod.Network;
objSmtpClient.Send(objMailMessage);
}
catch (Exception ex)
{ throw ex; }
finally
{
objMailMessage = null;
objSMTPUserInfo = null;
objSmtpClient = null;
}
}
On Wed, Mar 30, 2016 at 6:02 AM, Laurie Alvey <[email protected]> wrote:
> I currently use CDO to send email from my apps but I'm thinking of using a
> .NET component to do it. I have little experience with .NET and none using
> .NET Interop. I've got Visual Studio Express 14.0 and VFP 9.0 SP2 and would
> appreciate any pointers.
>
> Laurie
>
>
> --- StripMime Report -- processed MIME parts ---
> multipart/alternative
> text/plain (text body -- kept)
> text/html
> ---
>
[excessive quoting removed by server]
_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://mail.leafe.com/mailman/listinfo/profox
OT-free version of this list: http://mail.leafe.com/mailman/listinfo/profoxtech
Searchable Archive: http://leafe.com/archives/search/profox
This message:
http://leafe.com/archives/byMID/profox/cajidmyktoxbkgg9wxvjhzfuh3ry7t4pot4e508ty89ovo9h...@mail.gmail.com
** All postings, unless explicitly stated otherwise, are the opinions of the
author, and do not constitute legal or medical advice. This statement is added
to the messages for those lawyers who are too stupid to see the obvious.