Карта сайта Kansoftware
НОВОСТИУСЛУГИРЕШЕНИЯКОНТАКТЫ
Разработка программного обеспечения
KANSoftWare

Прочитать адрес отправителя сообщения для MS Outlook

Delphi , Интернет и Сети , Почтовый клиент

Прочитать адрес отправителя сообщения для MS Outlook

Оформил: DeeCo
Автор: http://www.swissdelphicenter.ch

{ 
  If you tried to work with messages from Delphi, you know that received message have the 
  SenderName property (name of sender) but doesn't allow to read the real address of sender. 
  Something like SenderAddress is not available. 

  There exist a few methods to retrieve this information: 

  1. help file says that sender is in Recipients collection 
  with Type property - 0 (olOriginator). 
  But this way does work for any version of MS Outlook. 
  So just iterate thru collection of Recipients and find an item with Type=0 
  couldn't return required value 

  2. as alternative you can read a ReplyTo property - there you'll receive an address 
  (but generally ReplyTo and Sender could be different). 
  For example, in messages which I send from own mail account these values are different. 

  3. to create a new MailItem (just will be destroyed without saving in end of work), 
  define a Recipient as value which you received from SenderName of your original 
  message and call a Resolve method - after that you'll recieve a correct email address of this sender. 

  4. more correct and fast solution is the next: 
}

 var
  s: string;
  objCDO: OLEVariant;
 begin
   objCDO := CreateOLEObject('MAPI.Session');
   objCDO.Logon('', '', False, False);
   objMsg := objCDO.GetMessage(itemOL.EntryID, itemOL.Parent.StoreID);

   s := objMsg.Sender.Address;
   ShowMessage(s);
   objMsg := Unassigned;
   objCDO := Unassigned;
 end


 { where itemOL is a MailItem which contain a SenderName but doesn't contain a SenderAddress }

Статья Прочитать адрес отправителя сообщения для MS Outlook раздела Интернет и Сети Почтовый клиент может быть полезна для разработчиков на Delphi и FreePascal.


Комментарии и вопросы


Ваше мнение или вопрос к статье в виде простого текста (Tag <a href=... Disabled). Все комментарии модерируются, модератор оставляет за собой право удалить непонравившейся ему комментарий.

заголовок

e-mail

Ваше имя

Сообщение

Введите код




Материалы статей собраны из открытых источников, владелец сайта не претендует на авторство. Там где авторство установить не удалось, материал подаётся без имени автора. В случае если Вы считаете, что Ваши права нарушены, пожалуйста, свяжитесь с владельцем сайта.



:: Главная :: Почтовый клиент ::


реклама



©KANSoftWare (разработка программного обеспечения, создание программ, создание интерактивных сайтов), 2007
Top.Mail.Ru Rambler's Top100
18.04.2024 11:18:49/0.033104181289673/0