Is it possible to read and send mails from Exchange Server?
Is it possible to read and send mails from Exchange Server?
Hi,
Is it possible to read and send mails from Exchange Server? Is there any example for it?
Thanks in advance.
Is it possible to read and send mails from Exchange Server? Is there any example for it?
Thanks in advance.
Regards,
Hakan ONEMLI
Harbour & MSVC 2022 & FWH 23.04
Hakan ONEMLI
Harbour & MSVC 2022 & FWH 23.04
Re: Is it possible to read and send mails from Exchange Server?
Do you mean to say that you would like to Send/Receive email withot using Outlook Express/ MS Outlook or any other email client software
I believe that you can use CDO to access Exchange Server or any mail server to send and receive emails.
http://forums.fivetechsupport.com/viewtopic.php?f=3&t=15843
Regards
Anser
I believe that you can use CDO to access Exchange Server or any mail server to send and receive emails.
http://forums.fivetechsupport.com/viewtopic.php?f=3&t=15843
Regards
Anser
Re: Is it possible to read and send mails from Exchange Server?
Thanks Anser,
This example is related sending mails. Is there any examples that reading mails?
This example is related sending mails. Is there any examples that reading mails?
Regards,
Hakan ONEMLI
Harbour & MSVC 2022 & FWH 23.04
Hakan ONEMLI
Harbour & MSVC 2022 & FWH 23.04
Re: Is it possible to read and send mails from Exchange Server?
Hi Hakan,
Sorry, I don't have any samples to demonstrate retrieval of email messages from a POP3 server. I have not tried this till now.
I think MAPI is the way to go for reading mails and CDO is used mostly for sending mails.
Regards
Anser
Sorry, I don't have any samples to demonstrate retrieval of email messages from a POP3 server. I have not tried this till now.
I think MAPI is the way to go for reading mails and CDO is used mostly for sending mails.
Regards
Anser
Re: Is it possible to read and send mails from Exchange Server?
Hi all,
Anybody here tried to read a POP3 Server to find out new unread mails in a POP3 server. I understand that MAPI32.DLL is used and the progid for the DLL is
CREATEOBJECT (the ProgIDs for these controls are MSMAPI.MAPIMessages and MSMAPI.MAPISession).
But I am getting an error when I try this
I get the following error
[list=]Application
===========
Path and name: D:\FwhExtra\FWHTests\ReadMail.exe (32 bits)
Size: 1,846,784 bytes
Time from start: 0 hours 0 mins 0 secs
Error occurred at: 11/18/09, 13:40:20
Error description: Error TOleAuto/65535 : TOLEAUTO:NEW
Args:
[ 1] = C MSMAPI.MAPISession
[ 2] = U
[ 3] = U
Stack Calls
===========
Called from: => THROW(0)
Called from: source\rtl\win32ole.prg => TOLEAUTO:NEW(346)
Called from: source\rtl\win32ole.prg => CREATEOBJECT(78)
Called from: ReadMail.prg => MAIN(7)
[/list]
Any idea ? Do I have to use the DECLARE DLL ?
Regards
Anser
Anybody here tried to read a POP3 Server to find out new unread mails in a POP3 server. I understand that MAPI32.DLL is used and the progid for the DLL is
CREATEOBJECT (the ProgIDs for these controls are MSMAPI.MAPIMessages and MSMAPI.MAPISession).
But I am getting an error when I try this
Code: Select all | Expand
oSession:=CreateObject("MSMAPI.MAPISession")
I get the following error
[list=]Application
===========
Path and name: D:\FwhExtra\FWHTests\ReadMail.exe (32 bits)
Size: 1,846,784 bytes
Time from start: 0 hours 0 mins 0 secs
Error occurred at: 11/18/09, 13:40:20
Error description: Error TOleAuto/65535 : TOLEAUTO:NEW
Args:
[ 1] = C MSMAPI.MAPISession
[ 2] = U
[ 3] = U
Stack Calls
===========
Called from: => THROW(0)
Called from: source\rtl\win32ole.prg => TOLEAUTO:NEW(346)
Called from: source\rtl\win32ole.prg => CREATEOBJECT(78)
Called from: ReadMail.prg => MAIN(7)
[/list]
Any idea ? Do I have to use the DECLARE DLL ?
Regards
Anser
- James Bott
- Posts: 4840
- Joined: Fri Nov 18, 2005 4:52 pm
- Location: San Diego, California, USA
- Contact:
Re: Is it possible to read and send mails from Exchange Server?
Anser,
Have you tried searching the forum for "POP3?" I seem to remember there was some sample code for this.
James
Have you tried searching the forum for "POP3?" I seem to remember there was some sample code for this.
James
Re: Is it possible to read and send mails from Exchange Server?
Dear Mr.James,
I tried the followinng link in the spanish forum, but unfortunately I could not get it work.
viewtopic.php?f=6&t=6258
As per the link, you need to download an OCX file named MSMAPI32.OCX. But even after registering the OCX, the program crashes. If you check the Valtype of the object created, instead of Object, it is showing as NUMERIC.
I am looking for a solution that works without any additional OCX control. I thought that the default CDO/MAPI would work without installing any additional OCX
Regards
Anser
I tried the followinng link in the spanish forum, but unfortunately I could not get it work.
viewtopic.php?f=6&t=6258
As per the link, you need to download an OCX file named MSMAPI32.OCX. But even after registering the OCX, the program crashes. If you check the Valtype of the object created, instead of Object, it is showing as NUMERIC.
I am looking for a solution that works without any additional OCX control. I thought that the default CDO/MAPI would work without installing any additional OCX
Regards
Anser
- James Bott
- Posts: 4840
- Joined: Fri Nov 18, 2005 4:52 pm
- Location: San Diego, California, USA
- Contact:
Re: Is it possible to read and send mails from Exchange Server?
Dear Mr.James,
Thank you. FiveWin's TPop3 is working fine and this the one which I was looking for. Now I need to understand the techniques used to extract the header, attachments, Subject, Sender's details etc. from the array aMsgs
Regards
Anser
Thank you. FiveWin's TPop3 is working fine and this the one which I was looking for. Now I need to understand the techniques used to extract the header, attachments, Subject, Sender's details etc. from the array aMsgs
Regards
Anser
- James Bott
- Posts: 4840
- Joined: Fri Nov 18, 2005 4:52 pm
- Location: San Diego, California, USA
- Contact:
Re: Is it possible to read and send mails from Exchange Server?
Dear Mr.James,
Another problem which I see is that TPop3 downloads the whole email. (TelNet command RETR). I have to download the whole mail and then extract the headers from it and will be time consuming if attachments are there ( depends on the email size). Hope there is some other technique to get the header only (From,To,Subject,Email Size), so that it is faster. Nowadays, most mobile phone supports the retrieval of Email Headers. I know that TPop3 is supposed to be used to retrieve emails from POP3 servers. Just wondering whether another method exist to retrieve the header only. I did not find any TelNet commands to retrieve just the header. LIST will give the message no's and size in bytes
Regards
Anser
Another problem which I see is that TPop3 downloads the whole email. (TelNet command RETR). I have to download the whole mail and then extract the headers from it and will be time consuming if attachments are there ( depends on the email size). Hope there is some other technique to get the header only (From,To,Subject,Email Size), so that it is faster. Nowadays, most mobile phone supports the retrieval of Email Headers. I know that TPop3 is supposed to be used to retrieve emails from POP3 servers. Just wondering whether another method exist to retrieve the header only. I did not find any TelNet commands to retrieve just the header. LIST will give the message no's and size in bytes
Regards
Anser
- James Bott
- Posts: 4840
- Joined: Fri Nov 18, 2005 4:52 pm
- Location: San Diego, California, USA
- Contact:
Re: Is it possible to read and send mails from Exchange Server?
Anser,
I know that this is possible because I have a program that does it (not a FW program). I do not know how to do it using FWH. I would try searching the NET.
Regards,
James
Just wondering whether another method exist to retrieve the header only.
I know that this is possible because I have a program that does it (not a FW program). I do not know how to do it using FWH. I would try searching the NET.
Regards,
James
Re: Is it possible to read and send mails from Exchange Server?
Dear Mr.James,
With few minor changes in our own FiveWin Class TPop3, we can get the headers only from email. This method is fast, because the whole email is not downloaded, but just the headers. I modified the class with an additional data, so that the programmer can decide whether he wants to download the whole email message or just the header.
The default value of the data ::lHeaderOnly is .F., and for those who require to download only the headers can set the value to .T.
This will be useful for those who want to check the email messages for a specific subject/From address in a much faster way.
Regards
Anser
With few minor changes in our own FiveWin Class TPop3, we can get the headers only from email. This method is fast, because the whole email is not downloaded, but just the headers. I modified the class with an additional data, so that the programmer can decide whether he wants to download the whole email message or just the header.
Code: Select all | Expand
oInMail = TPop3():New( cIp,, cUserName, cPassword )
oInMail:lHeaderOnly:=.T. // Retrieves only the headers
The default value of the data ::lHeaderOnly is .F., and for those who require to download only the headers can set the value to .T.
This will be useful for those who want to check the email messages for a specific subject/From address in a much faster way.
Regards
Anser
Re: Is it possible to read and send mails from Exchange Server?
Hi Anser,
Is it possible to share changes in TPop3 Class if you don't mind?
Thanks in advance.
Is it possible to share changes in TPop3 Class if you don't mind?
Thanks in advance.
Regards,
Hakan ONEMLI
Harbour & MSVC 2022 & FWH 23.04
Hakan ONEMLI
Harbour & MSVC 2022 & FWH 23.04
Re: Is it possible to read and send mails from Exchange Server?
The changes required in TPop3.Prg
CLASS TPop3
METHOD New()
In METHOD OnRead()
Line 147
Line 161
Line 183
Mr.Antonio,
Do you mind including this modified class in the next FWH build ? I shall send the modified class to your mail id
Regards
Anser
CLASS TPop3
Code: Select all | Expand
DATA lHeaderOnly // New Data
METHOD New()
Code: Select all | Expand
::lHeaderOnly:=.F. // Initialize the Value to .F.
In METHOD OnRead()
Line 147
Code: Select all | Expand
if ::lHeaderOnly
cCommand = "TOP " + AllTrim( Str( 1, 4, 0 ) )+ " 0" + CRLF
Else
cCommand = "RETR " + AllTrim( Str( 1, 4, 0 ) )+ CRLF
Endif
Line 161
Code: Select all | Expand
if ::lHeaderOnly
cCommand = "TOP " + AllTrim( Str( ++::nAtMsg, 4, 0 ) ) + " 0" + CRLF
Else
cCommand = "RETR " + AllTrim( Str( ++::nAtMsg, 4, 0 ) ) + CRLF
Endif
Line 183
Code: Select all | Expand
if ::lHeaderOnly
cCommand = "TOP " + AllTrim( Str( ++::nAtMsg, 4, 0 ) ) + " 0" + CRLF
else
cCommand = "RETR " + AllTrim( Str( ++::nAtMsg, 4, 0 ) ) + CRLF
Endif
Mr.Antonio,
Do you mind including this modified class in the next FWH build ? I shall send the modified class to your mail id
Regards
Anser