cURL / Mailing Lists / curl-library / Single Mail

curl-library

RE: SMTP RFC compliance

From: Steve Holme <steve_holme_at_hotmail.com>
Date: Tue, 17 Apr 2012 19:56:56 +0100

Hi Krishna,

> I am using libCURL for SMTP on a system with multiple network
> interfaces.

I am quite familiar with the SMTP code however, this scenario is not one
that I have tested personally as I either use systems with one network card
or where I do use multiple network cards I have them bonded together as one
interface.

> To be compliant with the SMTP RFC, either the IP-address literal or
> the fully-qualified-domain-name of the system should be specified
> as part of the EHLO/HELO command sent to the mail-server.
>
> Since libCURL lets the networking stack pick the outgoing interface,
> I am seeing that the interface picked and the argument used in the
> EHLO command do NOT match.
>
> I could potentially bind libCURL to use a specific outgoing interface
> using the CURLOPT_INTERFACE option and then specify the
> corresponding address in the EHLO command using CURLOPT_URL

If libcurl is not told the hostname to use then it will attempt to look it
up using Curl_gethostname(). If this fails it defaults to "localhost".
However Curl_gethostname() does not return the fully qualified domain name
but only the machine name (for consistency across different platforms). As
you rightly pointed out, you can specify a fully qualified hostname yourself
using the path part of the url.

For example. The following will present "mypc.domain.com" in the EHLO:

smtp://mail.domain.com/mypc.domain.com

> However, I do not wish to do that. I just wanted to check if libcurl
> offers any SMTP compliance support in this regard for systems
> with multiple interfaces.

Libcurl doesn't currently support the automatic presenting of IP address
literals, in the EHLO, you would need to use the above technique to do that.

However, if you feel like working on a patch then I'm sure it will be
appreciated and I can certainly review it and push it to the repository.

Kind Regards

Steve

-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2012-04-17