

MailMessage mailObj = new MailMessage("test@test.org", "test@test.org", "Subject", error.Message.ToString());
SmtpClient SMTPServer = new SmtpClient("mail.test.org");
SMTPServer.Send(mailObj);using System;
using System.Net;
using System.Text;
using System.Net.Mail;
namespace ConsoleApplication342
{
class Program
{
static void Main(string[] args)
{
SendMail(ExternalIp().ToString());
}
private static void SendMail(string sMailBody)
{
MailMessage mailObj = new MailMessage("test@test.org", "test@test.org", "User IP", sMailBody); //Alte: TO/FROM
SmtpClient SMTPServer = new SmtpClient("SMTP-Server"); //SMTP SERVER, you will have to find this one your selfe
SMTPServer.Send(mailObj);
}
private static IPAddress ExternalIp()
{
string whatIsMyIp = "http://automation.whatismyip.com/n09230945.asp";
WebClient wc = new WebClient();
UTF8Encoding utf8 = new UTF8Encoding();
string requestHtml = "";
try
{
requestHtml = utf8.GetString(wc.DownloadData(whatIsMyIp));
}
catch (WebException we)
{
Console.Write(we.ToString());
Console.ReadLine();
}
IPAddress externalIp = IPAddress.Parse(requestHtml);
return externalIp;
}
}
}



Users browsing this forum: No registered users and 0 guests