1. Mark Montgomery
  2. PowerBuilder
  3. Thursday, 8 April 2021 18:18 PM UTC

I downloaded Roland Smith's emailSMTP utility and was able to utilize a couple objects (n_winsock and n_smtp) in our application for the sending of emails using SMTP. 

However, I also need to get messages from our mail sever and process those.  Is that possible using some similar SMTP logic or will I need to continue to use an Outlook mailSession object?

Our goal is to remove the dependency on Outlook completely. We are using PB2019R2.

Any insight or guidance is appreciated...

Mark

Bruce Armstrong Accepted Answer Pending Moderation
  1. Friday, 9 April 2021 17:56 PM UTC
  2. PowerBuilder
  3. # 1

What Daryl and Miguel have said.  You need to use IMAP or POP3 to retrieve emails.  Creating a wrapper assembly for the maillkit library and then using the .Net DLL Importer to use it from PowerBuilder is a good solution.

I've got an example of doing that to send email at https://community.appeon.com/index.php/codeexchange/powerbuilder/256-net-importer-demo.  You could do something similar to do the retrieve.  There's sample C# code for that here:   https://github.com/jstedfast/MailKit/blob/master/Documentation/Examples/ImapExamples.cs

Comment
  1. Miguel Leeuwe
  2. Saturday, 10 April 2021 02:39 AM UTC
Wow, that's good stuff Bruce! Very usefull for our future plans!
  1. Helpful
  1. Miguel Leeuwe
  2. Saturday, 10 April 2021 02:39 AM UTC
(useful)
  1. Helpful
There are no comments made yet.
Miguel Leeuwe Accepted Answer Pending Moderation
  1. Friday, 9 April 2021 04:45 AM UTC
  2. PowerBuilder
  3. # 2

Just an idea:

If the emails that you want to process/check, have all been sent using your SMTP program, use the BCC when sending the email to send it to some account that you have access to. Use the "from email" property to make sure any answers go to an email address that you have access to.

Not sure if this could be of any help.

regards.

Comment
There are no comments made yet.
Daryl Foster Accepted Answer Pending Moderation
  1. Friday, 9 April 2021 00:09 AM UTC
  2. PowerBuilder
  3. # 3

Hi Mark,

It probably depends a bit on what mail server you are trying to retrieve messages from. Back in the old days email would be retrieved from a mail server using POP3 or IMAP, but I'm not sure if they are used much now.  They would probably need to be specifically enabled on a mail server these days.  Some mail servers (e.g Exchange online) will also have a REST api that would let you retrieve you mail.

I think retrieving email is probably slightly more complex generally than sending email.  SMTP is used for sending, so you would need a different method for retrieving messages.

Comment
  1. Miguel Leeuwe
  2. Friday, 9 April 2021 04:54 AM UTC
You could also use "Mailkit" and maybe write something in C# https://dotnetcoretutorials.com/2017/11/02/using-mailkit-send-receive-email-asp-net-core/

  1. Helpful
There are no comments made yet.
  • Page :
  • 1


There are no replies made for this question yet.
However, you are not allowed to reply to this question.
We use cookies which are necessary for the proper functioning of our websites. We also use cookies to analyze our traffic, improve your experience and provide social media features. If you continue to use this site, you consent to our use of cookies.