Can i extracts original email address from exchange mail
A very specific question!
Yes, it is possible to extract the original email address from an Exchange email. Here are a few methods:
Method 1: Using Exchange PowerShell
You can use the Exchange PowerShell module to extract the original email address from an Exchange email. Here's an example:
Get-Mailbox -Identity <mailbox_name> | Get-MessageTrackingLog -Start <date> -End <date> | Select-Object -ExpandProperty OriginalSender
Replace <mailbox_name>
with the name of the mailbox you want to extract the email from, <date>
with the date range you're interested in, and OriginalSender
with the property you want to extract (in this case, the original email address).
Method 2: Using Exchange Web Services (EWS)
You can use EWS to retrieve the original email address from an Exchange email. Here's an example:
using System;
using System.Net;
using System.Xml;
using Microsoft.Exchange.WebServices.Data;
class GetOriginalEmail
{
static void Main(string[] args)
{
// Set up EWS connection
ExchangeService service = new ExchangeService(ExchangeVersion.Exchange2010_SP1);
service.Credentials = new WebCredentials("username", "password", "domain");
service.Url = new Uri("https://exchange_server/ews/exchange.asmx");
// Set up search criteria
SearchFilter sf = new SearchFilter.IsEqualTo(ItemSchema.Subject, "subject");
ItemView iv = new ItemView(1);
// Search for email
FindItemsResults<Item> findResults = service.FindItems(WellKnownFolderName.Inbox, sf, iv);
// Get the first email
Item email = findResults.Items[0];
// Get the original sender
string originalSender = email.GetExtendedProperty("urn:schemas:httpmail:sender");
Console.WriteLine("Original sender: " + originalSender);
}
}
Replace username
, password
, domain
, and exchange_server
with your actual credentials and Exchange server URL.
Method 3: Using Exchange Management Shell
You can use the Exchange Management Shell to extract the original email address from an Exchange email. Here's an example:
Get-Mailbox -Identity <mailbox_name> | Get-MessageTrackingLog -Start <date> -End <date> | Select-Object -ExpandProperty OriginalSender
This is similar to Method 1, but uses the Exchange Management Shell instead of PowerShell.
Note that these methods require access to the Exchange server and the necessary credentials. Additionally, the original email address may not always be available, especially if the email has been forwarded or relayed.