VS.NET 2010 (and above) Users Click Here   

HOMECONTACT PRODUCTS DOWNLOADS PURCHASE TESTIMONIALS FORUMS COMPANY CONTACT
Home
Products
Downloads
Purchase
Licensing
Licensing FAQ
Software Updates
Support Forums
Testimonials
Feature Requests
Guarantee
About Us
Contact Us
Hosting Companies
Privacy Policy
   
Shopping Cart


aspNetIMAP forum



[ Reply to Post ] [ Back To Forum ]
From: "dave wanta" <dave@...>
Date: 7/18/2012 12:33:25 PM
Subject: RE: Imap sender Ip
Ok, here is some rought code that will extract the IP address for you. There isn't any error checking in there (to keep the code short), but it extracts the IP.

			string headersText = @"Received: from SJSWT46-16.opi.com (unknown [123.125.46.16])
	by mx1 (Coremail) with SMTP id H8mowEDZmWbz3OlPVT9_Bw--.1278S2;
	Wed, 27 Jun 2012 00:01:55 +0800 (CST)
Received: from SJSWT46-196.opi.com (SJSWTg46-196.opi.com [123.125.46.196])
	by SJSWT46-16.opi.com (Postfix) with ESMTP id EFC6E4C0FD5
	for <a10121675@126.com>; Wed, 27 Jun 2012 00:01:55 +0800 (CST)
Date: Wed, 27 Jun 2012 00:01:55 +0800 (CST)
From: =?UTF-8?B?5Lq65Lq6572R?= <noreply+mOuTXACvZiG5Mm3wYuhyDbG4@xiaonei-inc.com>
To: a10121675@126.com
Message-ID: <1910207908.352142643.1340726515979.JavaMail.root@SJSWT46-196.opi.com>
Subject: =?UTF-8?B?5Lq65Lq6572R55m75b2V56Gu6K6k?=
MIME-Version: 1.0
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
";

			MimeMessage m= MimeMessage.ParseString( headersText  );

			ArrayList list = m.Headers.Matching( "Received");
			Header h = list[0] as Header;

			string recText = h.Value;

			Regex r = new Regex(
    @"\[(?<ip>(\d+|\.)+)\]",
    RegexOptions.IgnoreCase
    | RegexOptions.Multiline
    | RegexOptions.IgnorePatternWhitespace
    | RegexOptions.Compiled
    );

			Match match = r.Match( recText  );

			string ip = match.Groups["ip"].Value;



Let me know if you need anything else,
Dave

 

 

 



Thread View

Subject By Date
Imap sender Ip Pis 7/17/2012
   RE: Imap sender Ip dave wanta 7/17/2012
     RE: Imap sender Ip Pis 7/17/2012
       RE: Imap sender Ip [ you are here ] dave wanta 7/18/2012

 

 

Testimonial

Great tool, Dave. I cannot tell you how much work this has saved me. "

Paul | Assisted Solutions

Read more testimonials
ListNanny aspNetDNS aspNetEmail aspNetPOP3 aspNetMX IPMuncher aspNetMIME aspNetPING aspNetTraceRoute aspNetIMAP aspNetMHT