Does libsoup handle smtp verbs like HELO (with argument)?

42 Views Asked by At

I am trying to move from CURL to SOUP, but need help with smtp.

At the moment, I am just trying to HELO

CURL will allow

curl -X "HELO myService" smtps://smtp.server.com

I am trying to do the same with soup. So far I have:

let httpSession = new Soup.Session();
let message = new Soup.Message({ method: 'HELO myService', uri: 'smtps://smtp.server.com' });
httpSession.send_and_read_async(message, 2, null, (res) => {
  const r = httpSession.send_and_read_finish(res);
  log(r);
});

But the code just hangs and I don't know if it's a bad implementation of soup or something soup just doesn't do...

Any pointers would be greatly appreciated.

1

There are 1 best solutions below

0
On BEST ANSWER

HELO is an SMTP command. Libsoup is an HTTP client, and SMTP and HTTP are different protocols, so this won't work.

I don't know of an SMTP library that exists for GJS, but you can probably write something using Gio.SocketClient, by cribbing from libnetclient which is a POP and SMTP client based on GIO. Or you could even try to build an introspected version of libnetclient and use it from GJS.