Модераторы: MetalFan
  

Поиск:

Ответ в темуСоздание новой темы Создание опроса
> Как прочитать адрес отправителя? 
:(
    Опции темы
Poseidon
Дата 19.5.2005, 02:21 (ссылка) | (нет голосов) Загрузка ... Загрузка ... Быстрая цитата Цитата


Delphi developer
****


Профиль
Группа: Комодератор
Сообщений: 5273
Регистрация: 4.2.2005
Где: Гомель, Беларусь

Репутация: нет
Всего: 133



Код

  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 } 



--------------------
Если хочешь, что бы что-то работало - используй написанное, 
если хочешь что-то понять - пиши сам...
PM MAIL ICQ   Вверх
  
Ответ в темуСоздание новой темы Создание опроса
Правила форума "Delphi: ActiveX/СОМ/CORBA"

Rrader
Girder

Запрещено:

1. Публиковать ссылки на вскрытые компоненты

2. Обсуждать взлом компонентов и делиться вскрытыми компонентами


  • Литературу по Delphi обсуждаем здесь
  • Действия модераторов можно обсудить здесь
  • С просьбами о написании курсовой, реферата и т.п. обращаться сюда
  • Вопросы по реализации алгоритмов рассматриваются здесь
  • 90% ответов на свои вопросы можно найти в DRKB (Delphi Russian Knowledge Base) - крупнейшем в рунете сборнике материалов по Delphi
  • Вопросы по SQL и вопросы по базам данных, не связанные с Delphi, задавать здесь

Если Вам помогли, и атмосфера форума Вам понравилась, то заходите к нам чаще! С уважением, Rrader, Girder.

 
1 Пользователей читают эту тему (1 Гостей и 0 Скрытых Пользователей)
0 Пользователей:
« Предыдущая тема | Delphi: ActiveX/СОМ/CORBA | Следующая тема »


 




[ Время генерации скрипта: 0.0478 ]   [ Использовано запросов: 22 ]   [ GZIP включён ]


Реклама на сайте     Информационное спонсорство

 
По вопросам размещения рекламы пишите на vladimir(sobaka)vingrad.ru
Отказ от ответственности     Powered by Invision Power Board(R) 1.3 © 2003  IPS, Inc.