Lazarus

Programming => Networking and Web Programming => Topic started by: HatForCat on November 26, 2019, 03:55:19 pm

Title: Simple POP email reader?
Post by: HatForCat on November 26, 2019, 03:55:19 pm
Hello, I am looking for some sample code for a simple POP3 email reader. I have a few online accounts that send an OTP (One Time Password) to to verify it's me.

If we are watching a movie and the feed suddenly decides it needs to verify, I have to go up to the office, fire up my main PC and load the email system and check for emails, memorize the code and go back down and enter it.

I'd like a minimalist POP reader I can put on the Home Theater PC and double-click the icon for it to get just the emails for some hard-coded sites and display the contents.

Can someone please point me at some sample code? I feel sure there must be some example programs out there but my searching so far, has returned nothing helpful.
Title: Re: Simple POP email reader?
Post by: sstvmaster on November 26, 2019, 08:17:21 pm
Hmm, install Thunderbird? This is simple.  :D
Title: Re: Simple POP email reader?
Post by: winni on November 26, 2019, 09:17:58 pm
Hi!

Don't make it too complicated.

Install a VNC-Server on your main PC.
Install a VNC-Client on your Theater PC.
Done. 

On the most Linux distros there is VNC software.
But it also work with windows.

Winni
Title: Re: Simple POP email reader?
Post by: HatForCat on November 26, 2019, 11:52:08 pm
Don't make it too complicated.

Exactly and you guys so far haven't got the gist of a single click idea. I don't want to leave my main PC running all the time just to VNC into it. Which, by the way I could already do. But, even if I did I would still have to go through the loading email client, requesting emails and closing it after memorizing the OTP etc.

I want a small POP3 system that when I double click the icon it

opens/runs
connects to my email ISP-server
downloads only the specific email account emails.
displays the first line of all emails downloaded.
I memorize the OTP
Waits 2-minutes then closes itself.

In that time I have entered the OTP into the feed request and everyone is happy.

It's called automation! By the time I created the OP and now explained this all so far I could have written the thing. I give up.
Title: Re: Simple POP email reader?
Post by: winni on November 27, 2019, 12:07:08 am
There is no reply I think because the people don't understand why you want a complicated solution but you could do a simple one.

If you want a pop3 client there are no simple solutions that I know.

The most of the pop3 clients use either Indy or Synapse.
There are enough examples around.

Winni
Title: Re: Simple POP email reader?
Post by: ASBzone on November 27, 2019, 04:01:12 am
There is no reply I think because the people don't understand why you want a complicated solution but you could do a simple one.


 ;D



Title: Re: Simple POP email reader?
Post by: valdir.marcos on November 27, 2019, 06:14:54 am
Hello, I am looking for some sample code for a simple POP3 email reader. I have a few online accounts that send an OTP (One Time Password) to to verify it's me.
If we are watching a movie and the feed suddenly decides it needs to verify, I have to go up to the office, fire up my main PC and load the email system and check for emails, memorize the code and go back down and enter it.
I'd like a minimalist POP reader I can put on the Home Theater PC and double-click the icon for it to get just the emails for some hard-coded sites and display the contents.
Can someone please point me at some sample code? I feel sure there must be some example programs out there but my searching so far, has returned nothing helpful.

Don't make it too complicated.
Exactly and you guys so far haven't got the gist of a single click idea. I don't want to leave my main PC running all the time just to VNC into it. Which, by the way I could already do. But, even if I did I would still have to go through the loading email client, requesting emails and closing it after memorizing the OTP etc.

I want a small POP3 system that when I double click the icon it
opens/runs
connects to my email ISP-server
downloads only the specific email account emails.
displays the first line of all emails downloaded.
I memorize the OTP
Waits 2-minutes then closes itself.

In that time I have entered the OTP into the feed request and everyone is happy.
It's called automation! By the time I created the OP and now explained this all so far I could have written the thing. I give up.
Here's all the information you need to build yourself your own "simple POP3 email reader":

I am not a parott that repeats documentation. Both Indy and Synapse have examples and documentation. Four letter acromym that starts with R and ends with M. >:D

But here you go, your laziness (don't EVER ask such questions again without at least a google attempt by yourself):
A synapse example with attachment:
http://stackoverflow.com/questions/6765008/send-an-email-with-attachment-client-agnostic

Which is better to use INDY 10 or Synapse?
https://forum.lazarus.freepascal.org/index.php/topic,33554.msg217635.html#msg217635

http://synapse.ararat.cz/doku.php/public:howto:pop3samplessl

POP3 SSL with Synapse
https://forum.lazarus.freepascal.org/index.php/topic,29515.0.html

Synapse reading pop3 mail in UTF-8 - Solved
https://forum.lazarus.freepascal.org/index.php/topic,31969.0.html

Synapse POP3, SLL and disaster strikes
https://forum.lazarus.freepascal.org/index.php/topic,20410.0.html

Synapse, OAuth2, Imap & Gmail
https://forum.lazarus.freepascal.org/index.php/topic,44007.0.html

Code: Pascal  [Select][+][-]
  1. // How To Use POP3 with SSL
  2. // http://synapse.ararat.cz/doku.php/public:howto:pop3samplessl
  3.  
  4.  
  5. uses
  6.   blcksock, smtpsend, pop3send, ssl_openssl,
  7. //...
  8.  
  9. type
  10.   ESMTP = class (Exception);
  11.   EPOP3 = class (Exception);
  12.  
  13. //...
  14.  
  15. procedure TForm1.edReceiveClick(Sender: TObject);
  16. var
  17.   pop3: TPOP3Send;
  18.   i: integer;
  19. begin
  20.   pop3 := TPOP3Send.Create();
  21.   try
  22.     pop3.AutoTLS := false;
  23.     pop3.Username:='test';
  24.     pop3.Password:='*****';
  25.     pop3.TargetHost:='127.0.0.1';
  26.     pop3.TargetPort := '995';
  27.     pop3.FullSSL := true;
  28.     pop3.Sock.SSL.SSLType := LT_SSLv3;
  29.  
  30.     pop3.Sock.SSLDoConnect();
  31.     if not pop3.Login() then
  32.       raise EPOP3.Create('POP3 ERROR: Login');
  33.  
  34.     AddToLog('POP3 Stat');
  35.     if not pop3.Stat() then
  36.       raise EPOP3.Create('POP3 ERROR: stat');
  37.     AddToLog('Stat: '+IntToStr(pop3.StatCount)+' msgs');
  38.     for i := 1 to pop3.StatCount do begin
  39.       AddToLog('POP3 Retr(' + IntToStr(i) + ')');
  40.       if not pop3.Retr(i) then
  41.         raise EPOP3.Create('POP3 ERROR: retr(' + IntToStr(i) + ')');
  42.       RichEdit2.lines.Add(' ');
  43.       RichEdit2.lines.Add('*** POP3 Retr(' + IntToStr(i) + ') *******');
  44.       RichEdit2.lines.AddStrings(pop3.FullResult);
  45.       pop3.FullResult.SaveToFile('mail_' + IntToStr(i) + '.msg');
  46.       if not pop3.Dele(i) then
  47.         raise EPOP3.Create('POP3 ERROR: dele(' + IntToStr(i) + ')');
  48.     end;
  49.  
  50.   finally
  51.     pop3.Free;
  52.   end;
  53. end;
Title: Re: Simple POP email reader?
Post by: PascalDragon on November 27, 2019, 09:10:29 am
There is no reply I think because the people don't understand why you want a complicated solution but you could do a simple one.
It might not be a simple idea to implement something like this, but the end result would be convenient. And that's what counts.
Title: Re: Simple POP email reader?
Post by: krexon on November 27, 2019, 09:40:11 am
Code: Pascal  [Select][+][-]
  1.     pop3.Sock.SSL.SSLType := LT_SSLv3;
Don't use SSLv3, it's insecure.
Title: Re: Simple POP email reader?
Post by: Remy Lebeau on November 27, 2019, 07:46:57 pm
If we are watching a movie and the feed suddenly decides it needs to verify, I have to go up to the office, fire up my main PC and load the email system and check for emails, memorize the code and go back down and enter it.

Um, why not simply have your email on a cell phone or tablet, and then keep that device handy nearby while watching the movie?  Or, there are plenty of 3rd party low-overhead POP3/IMAP checkers available (shameless plug: I used to use MailCheck myself - http://remy.lebeausoftware.org in the "Files" section - which was made by a friend of a friend).

The simplest solution is one that doesn't require any coding at all :D
Title: Re: Simple POP email reader?
Post by: Blade on June 04, 2021, 08:05:04 am
Interesting that nobody knew about this, but there is an e-mail notifier and previewer, that can also be configured to launch a more dedicated e-mail client of a person's choosing.  The source of the program has both Lazarus and Delphi versions.

https://sourceforge.net/projects/poptrayu/ (https://sourceforge.net/projects/poptrayu/)
(PoptrayU)
Title: Re: Simple POP email reader?
Post by: MarkMLl on June 04, 2021, 09:52:52 am
Um, why not simply have your email on a cell phone or tablet, and then keep that device handy

A throwaway gmail account with notifications on an Android 'phone is ideal for this, even for the most paranoid: use it for nothing except short-lived activation codes and Google (and their associates) will glean nothing about you that they don't know already.

MarkMLl
Title: Re: Simple POP email reader?
Post by: marcov on June 04, 2021, 10:28:41 am
OpenXP ?

https://sourceforge.net/projects/openxp5/
Title: Re: Simple POP email reader?
Post by: Blade on June 04, 2021, 11:25:03 am
OpenXP ?

Nice find, and Object Pascal source.
Title: Re: Simple POP email reader?
Post by: Blade on June 04, 2021, 12:38:35 pm
Or, there are plenty of 3rd party low-overhead POP3/IMAP checkers available (shameless plug: I used to use MailCheck myself - http://remy.lebeausoftware.org in the "Files" section - which was made by a friend of a friend).

The thing about MailCheck is it doesn't appear to show any source code, to include its history is nebulous.  When it comes to privacy and e-mail there is an obvious additional level of concern about security involved.
TinyPortal © 2005-2018