locked
Retrieve sender address Outlook Automation in VFP RRS feed

  • Question

  • Hello Experts,

    I am creating a small program that scans through my inbox for Subject = Convert2pdf and attachments to obviously convert to PDF, I have two minor problems but the biggest one I am faced with is retrieving the senders address where subject = Convert2Pdf

    I would like to be able to convert and send email with converted file right back to sender
    so I can do something like

    .Attachments.Add(lcSendersAddress)

    any help is much appreciated

    Wednesday, May 29, 2013 11:04 PM

Answers

  • What everything did you try already? Does Intellisense work for you in VFP? Just start to play...

    loApp = CREATEOBJECT('Outlook.application')
    loSpace = loApp.GetNameSpace('MAPI')
    inbox  = loSpace.GetDefaultFolder(6)
    ? inbox.Items.Count
    mail1 = inbox.Items(1)
    ? mail1.Sender
    ? mail1.Sender.Address
    
    You should also read following book: http://www.hentzenwerke.com/catalog/autofox.htm
    • Marked as answer by mikelvfp Thursday, May 30, 2013 4:25 PM
    Thursday, May 30, 2013 8:29 AM

All replies

  • not at all Pavel, just need to know how to retrieve Senders address as mentioned above

    Thanks

    Thursday, May 30, 2013 12:30 AM
  • What everything did you try already? Does Intellisense work for you in VFP? Just start to play...

    loApp = CREATEOBJECT('Outlook.application')
    loSpace = loApp.GetNameSpace('MAPI')
    inbox  = loSpace.GetDefaultFolder(6)
    ? inbox.Items.Count
    mail1 = inbox.Items(1)
    ? mail1.Sender
    ? mail1.Sender.Address
    
    You should also read following book: http://www.hentzenwerke.com/catalog/autofox.htm
    • Marked as answer by mikelvfp Thursday, May 30, 2013 4:25 PM
    Thursday, May 30, 2013 8:29 AM
  • Hi Pavel,

    It works thank you, however Im noticing the emails are getting stuck in my outbox unitll I manually send them out, any ideas?

    BTW, I just copied and pasted a portion of what I did, I thought maybe using ALLTRIM would fix the issue, but not so

    if lbOpenOutlook  && if true Outlook needs to be opened
    	oOutLook=createobject("Outlook.Application")
    endif	
    onamespace = oOutLook.getnamespace("MAPI")
    oinbox = onamespace.getdefaultfolder(nFolder)
    loitems = oinbox.items
    for each loitem in loitems
    	if loitem.subject = 'Resume'
    		loitem.subject = 'Resume'
    		loitem.sender
    		?loitem.sender.address
    		lcSenderAddress = ALLTRIM(loitem.sender.address)

    Any help is much appreciated
    Thursday, May 30, 2013 3:06 PM
  • nevermind, I figured it out, thank you Pavel once again :)

    Thursday, May 30, 2013 4:23 PM