Diese Seite mit anderen teilen ...

Informationen zum Thema:
Forum:
WinDev Forum
Beiträge im Thema:
3
Erster Beitrag:
vor 4 Jahren, 9 Monaten
Letzter Beitrag:
vor 4 Jahren, 9 Monaten
Beteiligte Autoren:
Arie, Al

WD17 - open new Outlook mail message

Startbeitrag von Arie am 03.11.2013 15:57

Hi,

I'm looking for a way to open the Outlook new-mail-window, with some values pre-entered by my application.
Like recepient, subject and so on. But also including attachements.

I noticed the Windev-preview window handles the pdf-to-mail button, by creating MSG files.
(have a look at the appdata\local\temp folder...)

Anyone did this before? Could you point me in the right direction, to save me from reinventing the WD-wheel on this one.
On Google I see several examples using .NET. Would that be the way to go?

Antworten:

Hello Arie

The Windev email example does some of this and all I do is fill in the email structure variable.

There was/is an issue when using the Outlook session process that can leaves the current folder as a default Microsoft ..1033 work folder that is really deeply buried in the users LocalSettings\....folder. This can happen if the process stops or exits with an error so I always save my current folder and then check to see if I need to set myself back to it as the current folder when I have finished emailing.


Regards
Al

von Al - am 03.11.2013 21:33
The WD Controllling Outlook example seems to have most of the stuff I need.
I can now open a new, prefilled, Outlook mail window.
I can also save the mail as a MSG file.
The idea now is to save email-messages as a msg-file, store them in the DB (memofield) and present them to the user, with some additional info. This way I can link email to employees or CRM.

In this particular case it is about a bookingsystem, where customers can confirm there reservation by email. My app is reading those replies from a specific mailbox, extracts all mails and checks for a bookingnumber. Finally storing and linking the email to a reservation. Users simply reply from within our bookingsystem.

For those interested, here are some snippets.

// "OutLook.Application" object
m_pautOutLook is object OLE dynamic
// Initialize the dialog with Outlook
:m_pautOutLook=GetActiveObject("OutLook.Application")
IF :m_pautOutLook=Null THEN :m_pautOutLook=new object OLE "OutLook.Application"
IF :m_pautOutLook=Null THEN
Error("Failure accessing Outlook")
END

// Creates an item in Outlook
:m_pautItem = :m_pautOutLook>>CreateItem(:m_nItemType)
// Subject
:m_pautItem>>Subject = :m_sSubject
// Content
:m_pautItem>>Body = :m_sContent
// Recipients
:m_pautItem>>To = :m_sDest
:m_pautItem>>cc = :m_sCCRECIP
:m_pautItem>>bcc = :m_sCCRECIP
// Attachment
:m_pautItem>>Attachments>>Add("C:\MyTest.txt")

// Display
:m_pautItem>>Display()

OR
// Send
:m_pautItem>>Send()

OR
// Save as MSG
// http://msdn.microsoft.com/en-us/library/office/aa219371(v=office.11).aspx -> olMSG=3
:m_pautItem>>SaveAs("C:\temp.msg", 3)

von Arie - am 04.11.2013 08:12
Zur Information:
MySnip.de hat keinen Einfluss auf die Inhalte der Beiträge. Bitte kontaktieren Sie den Administrator des Forums bei Problemen oder Löschforderungen über die Kontaktseite.
Falls die Kontaktaufnahme mit dem Administrator des Forums fehlschlägt, kontaktieren Sie uns bitte über die in unserem Impressum angegebenen Daten.