Trying to use wxEMail to delete message(s) Topic is solved

Talk here about issues with one of the components hosted at wxCode, or suggest features for it.
Widgets
Ultimate wxWidgets Guru
Ultimate wxWidgets Guru
Posts: 534
Joined: Thu Jun 01, 2006 4:36 pm
Location: Right here!

Trying to use wxEMail to delete message(s)

Post by Widgets »

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/11 64-bit & Mint 21.1
MSVC Express 2019/2022
wxWidgets 3.2.2
User avatar
evstevemd
Part Of The Furniture
Part Of The Furniture
Posts: 2408
Joined: Wed Jan 28, 2009 11:57 am
Location: United Republic of Tanzania

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

Post by evstevemd »

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?
Widgets
Ultimate wxWidgets Guru
Ultimate wxWidgets Guru
Posts: 534
Joined: Thu Jun 01, 2006 4:36 pm
Location: Right here!

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

Post by Widgets »

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/11 64-bit & Mint 21.1
MSVC Express 2019/2022
wxWidgets 3.2.2
User avatar
doublemax
Moderator
Moderator
Posts: 19103
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

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

Post by doublemax »

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
Ultimate wxWidgets Guru
Ultimate wxWidgets Guru
Posts: 534
Joined: Thu Jun 01, 2006 4:36 pm
Location: Right here!

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

Post by Widgets »

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/11 64-bit & Mint 21.1
MSVC Express 2019/2022
wxWidgets 3.2.2
User avatar
evstevemd
Part Of The Furniture
Part Of The Furniture
Posts: 2408
Joined: Wed Jan 28, 2009 11:57 am
Location: United Republic of Tanzania

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

Post by evstevemd »

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?
Widgets
Ultimate wxWidgets Guru
Ultimate wxWidgets Guru
Posts: 534
Joined: Thu Jun 01, 2006 4:36 pm
Location: Right here!

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

Post by Widgets »

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/11 64-bit & Mint 21.1
MSVC Express 2019/2022
wxWidgets 3.2.2
Widgets
Ultimate wxWidgets Guru
Ultimate wxWidgets Guru
Posts: 534
Joined: Thu Jun 01, 2006 4:36 pm
Location: Right here!

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

Post by Widgets »

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/11 64-bit & Mint 21.1
MSVC Express 2019/2022
wxWidgets 3.2.2
User avatar
evstevemd
Part Of The Furniture
Part Of The Furniture
Posts: 2408
Joined: Wed Jan 28, 2009 11:57 am
Location: United Republic of Tanzania

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

Post by evstevemd »

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?
Widgets
Ultimate wxWidgets Guru
Ultimate wxWidgets Guru
Posts: 534
Joined: Thu Jun 01, 2006 4:36 pm
Location: Right here!

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

Post by Widgets »

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/11 64-bit & Mint 21.1
MSVC Express 2019/2022
wxWidgets 3.2.2
User avatar
evstevemd
Part Of The Furniture
Part Of The Furniture
Posts: 2408
Joined: Wed Jan 28, 2009 11:57 am
Location: United Republic of Tanzania

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

Post by evstevemd »

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?
User avatar
doublemax
Moderator
Moderator
Posts: 19103
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

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

Post by doublemax »

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
Ultimate wxWidgets Guru
Ultimate wxWidgets Guru
Posts: 534
Joined: Thu Jun 01, 2006 4:36 pm
Location: Right here!

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

Post by Widgets »

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/11 64-bit & Mint 21.1
MSVC Express 2019/2022
wxWidgets 3.2.2
Widgets
Ultimate wxWidgets Guru
Ultimate wxWidgets Guru
Posts: 534
Joined: Thu Jun 01, 2006 4:36 pm
Location: Right here!

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

Post by Widgets »

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/11 64-bit & Mint 21.1
MSVC Express 2019/2022
wxWidgets 3.2.2
User avatar
doublemax
Moderator
Moderator
Posts: 19103
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

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

Post by doublemax »

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!
Post Reply