Trying to use wxEMail to delete message(s)  [SOLVED]

Talk here about issues with one of the components hosted at wxCode, or suggest features for it.
Widgets
Super wx Problem Solver
Super wx Problem Solver
Posts: 252
Joined: Thu Jun 01, 2006 4:36 pm
Location: Right here!

Trying to use wxEMail to delete message(s)

Postby Widgets » Wed Nov 11, 2015 5:49 pm

While using wxEMail, I have tried to figure out how to delete one or several e-mail messages, but have not had much luck.

Anyone have any pointers for this?
Is wxEMail even set up for this?

I have found something about suppressing messages, but don't see how to use it, if that is the mechanism to use.

TIA

Arnold
Environment: Win 10 64-bit
MSVC Express 2010 & 2015
wxWidgets 3.1
Fight SPAM - report it with wxSR

evstevemd
Part Of The Furniture
Part Of The Furniture
Posts: 2072
Joined: Wed Jan 28, 2009 11:57 am
Location: United Republic of Tanzania
Contact:

Re: Trying to use wxEMail to delete message(s)

Postby evstevemd » Fri Nov 13, 2015 7:56 pm

I have no idea but briceandre once talked about maintaining it. Am not sure he still does. Try to contact him
Chief Justice: We have trouble dear citizens!
Citizens: What it is his honor?
Chief Justice:Our president is an atheist, who will he swear to?
[Ubuntu 15.04/Windows 10 Pro - GCC/MinGW, CodeLite IDE et al]

Widgets
Super wx Problem Solver
Super wx Problem Solver
Posts: 252
Joined: Thu Jun 01, 2006 4:36 pm
Location: Right here!

Re: Trying to use wxEMail to delete message(s)  [SOLVED]

Postby Widgets » Fri Nov 13, 2015 8:30 pm

evstevemd wrote:I have no idea but briceandre once talked about maintaining it. Am not sure he still does. Try to contact him

Thank you for the interest.
The project seemed to be dead for so long, I thought it unlikely to be worth the trouble.
It certainly seems to have fallen by the wayside with no work or changes for years.
Then again, why not? :)
I'll give it a try
Environment: Win 10 64-bit
MSVC Express 2010 & 2015
wxWidgets 3.1
Fight SPAM - report it with wxSR

User avatar
doublemax
Moderator
Moderator
Posts: 11481
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: Trying to use wxEMail to delete message(s)

Postby doublemax » Fri Nov 13, 2015 9:09 pm

If you want to do anything serious related to email sending / receiving / processing i highly recommend this library:
http://www.chilkatsoft.com/email-features.asp

It's not free, but at a one-time-fee of 99 USD without royalties, it'll save you a lot of time and trouble.

Even if this sounds like advertisement, i'm not affiliated with them, just a happy customer ;)
Use the source, Luke!

Widgets
Super wx Problem Solver
Super wx Problem Solver
Posts: 252
Joined: Thu Jun 01, 2006 4:36 pm
Location: Right here!

Re: Trying to use wxEMail to delete message(s)

Postby Widgets » Fri Nov 13, 2015 9:44 pm

doublemax wrote:If you want to do anything serious related to email sending / receiving / processing i highly recommend this library:
http://www.chilkatsoft.com/email-features.asp

Thank you, Doblemax,

It is just for "in house" for now - and possible freeware eventually, so I guess I am not that serious :lol:
Environment: Win 10 64-bit
MSVC Express 2010 & 2015
wxWidgets 3.1
Fight SPAM - report it with wxSR

evstevemd
Part Of The Furniture
Part Of The Furniture
Posts: 2072
Joined: Wed Jan 28, 2009 11:57 am
Location: United Republic of Tanzania
Contact:

Re: Trying to use wxEMail to delete message(s)

Postby evstevemd » Sat Nov 14, 2015 7:00 am

I have never tried but libcurl is another choice worth of looking at
Chief Justice: We have trouble dear citizens!
Citizens: What it is his honor?
Chief Justice:Our president is an atheist, who will he swear to?
[Ubuntu 15.04/Windows 10 Pro - GCC/MinGW, CodeLite IDE et al]

Widgets
Super wx Problem Solver
Super wx Problem Solver
Posts: 252
Joined: Thu Jun 01, 2006 4:36 pm
Location: Right here!

Re: Trying to use wxEMail to delete message(s)

Postby Widgets » Sun Nov 15, 2015 2:01 am

evstevemd wrote:I have never tried but libcurl is another choice worth of looking at

It certainly looks like it might be a good alternative, especially as I would like to use threads so any operation can be terminated before it finishes.

As it happens, I have used libcurl in other projects, but only after fighting with wxEMail (and a reply from Andre Brice confirms that I am using the latest version he will be unable to further maintenance) and your comment that I had a more serious look at libcurl.

And it looks like libcurl might be able to do what I need without my getting too deep into reworking it, as it looks like I would have to do with wxEMail so thank you for the nudge in the right direction =D>
Environment: Win 10 64-bit
MSVC Express 2010 & 2015
wxWidgets 3.1
Fight SPAM - report it with wxSR

Widgets
Super wx Problem Solver
Super wx Problem Solver
Posts: 252
Joined: Thu Jun 01, 2006 4:36 pm
Location: Right here!

Re: Trying to use wxEMail to delete message(s)

Postby Widgets » Tue Nov 17, 2015 3:42 am

Guess I spoke too soon.

Just spent a whole lot of time with libcurl, including downloading and compiling the latest version, without getting anywhere with POP3 commands.

I've tried the command line, compiled their own samples in C - never mind my efforts on using POP 3 commands in code which works well with HTTP commands.
No luck at all - very disappointing :x
Environment: Win 10 64-bit
MSVC Express 2010 & 2015
wxWidgets 3.1
Fight SPAM - report it with wxSR

evstevemd
Part Of The Furniture
Part Of The Furniture
Posts: 2072
Joined: Wed Jan 28, 2009 11:57 am
Location: United Republic of Tanzania
Contact:

Re: Trying to use wxEMail to delete message(s)

Postby evstevemd » Tue Nov 17, 2015 6:46 am

Can you post a minimal code with what you want to accomplish?
Do you get any error? Please add useful information. Sorry for the disappointment but they are part and parcel of programming
Chief Justice: We have trouble dear citizens!
Citizens: What it is his honor?
Chief Justice:Our president is an atheist, who will he swear to?
[Ubuntu 15.04/Windows 10 Pro - GCC/MinGW, CodeLite IDE et al]

Widgets
Super wx Problem Solver
Super wx Problem Solver
Posts: 252
Joined: Thu Jun 01, 2006 4:36 pm
Location: Right here!

Re: Trying to use wxEMail to delete message(s)

Postby Widgets » Tue Nov 17, 2015 5:03 pm

evstevemd wrote:Can you post a minimal code with what you want to accomplish?
Do you get any error? Please add useful information. Sorry for the disappointment but they are part and parcel of programming

And so is misleading hype :shock:
Simply put, I would like top use libcurl to handle e-mail.
The simplest sample that I can give you and the one I tried, is one of those given on the libcurl example page: http://curl.haxx.se/libcurl/c/pop3-list.html

It may or may not be my pop3 server, but it simply refuses to even do that much.

Using Wireshark shows that the basic sample does nothing but issue a CAPA request and does not even try to log in, let alone issue a LIST (or any other) request.

I have given up on libcurl, but I thought I should answer your question.
As of yet I have not received any reply to my question on the libcurl mail list and yes, I am using the latest and greatest version of libcurl 7.45 and I have scoured the 'net for some _working_ sample code.
Environment: Win 10 64-bit
MSVC Express 2010 & 2015
wxWidgets 3.1
Fight SPAM - report it with wxSR

evstevemd
Part Of The Furniture
Part Of The Furniture
Posts: 2072
Joined: Wed Jan 28, 2009 11:57 am
Location: United Republic of Tanzania
Contact:

Re: Trying to use wxEMail to delete message(s)

Postby evstevemd » Tue Nov 17, 2015 5:30 pm

Do you have test credentials?
I would like to test for you that sample and hopefully fix something
Chief Justice: We have trouble dear citizens!
Citizens: What it is his honor?
Chief Justice:Our president is an atheist, who will he swear to?
[Ubuntu 15.04/Windows 10 Pro - GCC/MinGW, CodeLite IDE et al]

User avatar
doublemax
Moderator
Moderator
Posts: 11481
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: Trying to use wxEMail to delete message(s)

Postby doublemax » Tue Nov 17, 2015 5:50 pm

http://curl.haxx.se/libcurl/c/pop3-list.html

That sample code looks incomplete. At the very least you will need a write callback where you actually receive the data.

http://curl.haxx.se/libcurl/c/CURLOPT_W ... CTION.html
Use the source, Luke!

Widgets
Super wx Problem Solver
Super wx Problem Solver
Posts: 252
Joined: Thu Jun 01, 2006 4:36 pm
Location: Right here!

Re: Trying to use wxEMail to delete message(s)

Postby Widgets » Tue Nov 17, 2015 6:12 pm

evstevemd wrote:Do you have test credentials?

Not sure what you mean. What sort of credentials are you looking for?
evstevemd wrote:I would like to test for you that sample and hopefully fix something

Just download the code from the link I posted and compile it.
Let me know if it works for you :D
If it does, then we can try to sort out why it won't for me.
Environment: Win 10 64-bit
MSVC Express 2010 & 2015
wxWidgets 3.1
Fight SPAM - report it with wxSR

Widgets
Super wx Problem Solver
Super wx Problem Solver
Posts: 252
Joined: Thu Jun 01, 2006 4:36 pm
Location: Right here!

Re: Trying to use wxEMail to delete message(s)

Postby Widgets » Tue Nov 17, 2015 6:18 pm

doublemax wrote:http://curl.haxx.se/libcurl/c/pop3-list.html

That sample code looks incomplete. At the very least you will need a write callback where you actually receive the data.

http://curl.haxx.se/libcurl/c/CURLOPT_W ... CTION.html


At one point I did, though after looking at the 'stuff' sent on the wire by the sample, I gave up on it altogether.
I don't feel like debugging their code for them, though I did compile with debugging enabled and tried for a bit.

It did not even try to connect with the credentials I supplied and I verified as much with Wireshark for both the example and curl.exe (as compiled by the libcurl package).
Environment: Win 10 64-bit
MSVC Express 2010 & 2015
wxWidgets 3.1
Fight SPAM - report it with wxSR

User avatar
doublemax
Moderator
Moderator
Posts: 11481
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: Trying to use wxEMail to delete message(s)

Postby doublemax » Tue Nov 17, 2015 6:24 pm

The following code worked for me. For simplicity i put the receiving code into the OnAbout() method of the minimal sample.

Code: Select all

static int write_callback(void *buffer, size_t size, size_t nmemb, void *userdata)
{
   wxLogDebug("write_callback %ld", size*nmemb);
   wxString s((const char *)buffer, wxConvUTF8, size*nmemb);
   wxLogDebug(s);
   return (size*nmemb);
};

void MyFrame::OnAbout(wxCommandEvent& WXUNUSED(event))
{
   char curl_error_buf[CURL_ERROR_SIZE];

   CURL *curl = curl_easy_init();
   CURLcode res;

   if (curl == NULL)
      return;

   curl_easy_setopt(curl, CURLOPT_USERNAME, "username");
   curl_easy_setopt(curl, CURLOPT_PASSWORD, "password");

   /* This will list every message of the given mailbox */
   curl_easy_setopt(curl, CURLOPT_URL, "pop3://pop3.strato.de");

   curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, write_callback);
   curl_easy_setopt(curl, CURLOPT_FILE, this);

   curl_easy_setopt(curl, CURLOPT_ERRORBUFFER, curl_error_buf);
   //curl_easy_setopt(curl, CURLOPT_CONNECTTIMEOUT_MS, 5000);

   curl_easy_setopt(curl, CURLOPT_VERBOSE, 1L);

   res = curl_easy_perform(curl);

   wxString error_msg(curl_error_buf, wxConvUTF8);
   wxLogDebug("curl error: %s", error_msg);

   curl_easy_cleanup(curl);
}


Also be aware that many email providers don't allow unencrypted transfers any more. You need to connect through SSL/TLS for them.
Use the source, Luke!


Return to “wxCode”

Who is online

Users browsing this forum: No registered users and 2 guests