Recent

Author Topic: Simple POP email reader?  (Read 3227 times)

HatForCat

  • Sr. Member
  • ****
  • Posts: 293
Simple POP email reader?
« 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.
Acer-i5, 2.6GHz, 6GB, 500GB-SSD, Mint-19.3, Cinnamon Desktop, Lazarus 2.0.6, SQLite3

sstvmaster

  • Sr. Member
  • ****
  • Posts: 254
Re: Simple POP email reader?
« Reply #1 on: November 26, 2019, 08:17:21 pm »
Hmm, install Thunderbird? This is simple.  :D
Windows 10 (64 bit)
Lazarus: 2.0.12 / Trunk x32

winni

  • Hero Member
  • *****
  • Posts: 2507
Re: Simple POP email reader?
« Reply #2 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

HatForCat

  • Sr. Member
  • ****
  • Posts: 293
Re: Simple POP email reader?
« Reply #3 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.
Acer-i5, 2.6GHz, 6GB, 500GB-SSD, Mint-19.3, Cinnamon Desktop, Lazarus 2.0.6, SQLite3

winni

  • Hero Member
  • *****
  • Posts: 2507
Re: Simple POP email reader?
« Reply #4 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

ASBzone

  • Hero Member
  • *****
  • Posts: 613
  • Automation leads to relaxation...
    • Free Console Utilities for Windows (and a few for Linux) from BrainWaveCC
Re: Simple POP email reader?
« Reply #5 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



-ASB: https://www.BrainWaveCC.com/

Lazarus v2.0.13 r64843 / FPC v3.2.1-r49055 (via FpcUpDeluxe) -- Windows 64-bit install w/Win32 and Linux/Arm cross-compiles
Primary System: Windows 10 Pro x64, Version 2009 (Build 19042)
Other Systems: Windows 10 Pro x64, Version 2009 (Build 19042) or greater

valdir.marcos

  • Hero Member
  • *****
  • Posts: 1044
Re: Simple POP email reader?
« Reply #6 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;

PascalDragon

  • Hero Member
  • *****
  • Posts: 3195
  • Compiler Developer
Re: Simple POP email reader?
« Reply #7 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.

krexon

  • Jr. Member
  • **
  • Posts: 79
Re: Simple POP email reader?
« Reply #8 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.

Remy Lebeau

  • Hero Member
  • *****
  • Posts: 960
    • Lebeau Software
Re: Simple POP email reader?
« Reply #9 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
« Last Edit: November 27, 2019, 07:52:39 pm by Remy Lebeau »
Remy Lebeau
Lebeau Software - Owner, Developer
Internet Direct (Indy) - Admin, Developer (Support forum)

Blade

  • Full Member
  • ***
  • Posts: 114
Re: Simple POP email reader?
« Reply #10 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/
(PoptrayU)

MarkMLl

  • Hero Member
  • *****
  • Posts: 2869
Re: Simple POP email reader?
« Reply #11 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
Turbo Pascal v1 on CCP/M-86, multitasking with LAN and graphics in 128Kb.
Pet hate: people who boast about the size and sophistication of their computer.
GitHub repositories: https://github.com/MarkMLl?tab=repositories

marcov

  • Administrator
  • Hero Member
  • *
  • Posts: 9453
  • FPC developer.
Re: Simple POP email reader?
« Reply #12 on: June 04, 2021, 10:28:41 am »

Blade

  • Full Member
  • ***
  • Posts: 114
Re: Simple POP email reader?
« Reply #13 on: June 04, 2021, 11:25:03 am »
OpenXP ?

Nice find, and Object Pascal source.

Blade

  • Full Member
  • ***
  • Posts: 114
Re: Simple POP email reader?
« Reply #14 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