Upload of new mail via IMAP

2024-09-09 Thread Nicolas George via curl-users
Hi.

I need a tool to upload a new mail to a folder on an IMAP server.
Apparently, curl is almost capable of doing it with:

curl --user $login --url imaps://$server/$folder --upload-file $file

Unfortunately, the mail appears as already seen in the box. I need it to
be marked as new.

And apparently, this behavior is hard-coded:

  /* Send the APPEND command */
  result = imap_sendf(data,
  "APPEND %s (\\Seen) {%" CURL_FORMAT_CURL_OFF_T "}",
  mailbox, data->state.infilesize);

https://github.com/curl/curl/blob/master/lib/imap.c#L817

I can consider using a patched version of curl, a binary patch on the
Debian package to replace “(\\Seen)” with spaces works fine. But that is
not elegant.

Can I submit a feature wish to have an option to choose the presence or
absence of this “(\\Seen)” flag?


For reference, I need this for when our users go away and want to
forward their mail: an increasing number of destination will reject the
forwarded mail because it contains an unavoidable amount of spam. So
instead of forwarding it through SMTP I want to push it through IMAP.


Thanks in advance.

-- 
  Nicolas George
-- 
Unsubscribe: https://lists.haxx.se/mailman/listinfo/curl-users
Etiquette:   https://curl.se/mail/etiquette.html


Re: Upload of new mail via IMAP

2024-09-13 Thread Nicolas George via curl-users
Daniel Stenberg (12024-09-09):
> What would you say the ideal way would be to set such an option on the
> command line? Assuming we keep the current way the default for backwards
> compatibility.

Hi.

It seems to me the source code contains already quite a few
protocol-specific options:

https://github.com/curl/curl/blob/master/src/tool_getparam.c

  {"$q", "ftp-skip-pasv-ip", ARG_BOOL},
  {"*V", "aws-sigv4",ARG_STRING},
  {"$G", "delegation",   ARG_STRING},
  {"*e", "disable-epsv", ARG_BOOL},

Adding an extra option, maybe "mail-seen" would not be a betrayal.

Other possibilities would be to use the URL query string or fragment
string:

imaps://$server/$folder?seen=false
imaps://$server/$folder#seen=false

Regards,

-- 
  Nicolas George
-- 
Unsubscribe: https://lists.haxx.se/mailman/listinfo/curl-users
Etiquette:   https://curl.se/mail/etiquette.html