Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Sending Email by idSMTP from computers with underscore in name
(04-12-2019, 09:19 AM)Steffen Wrote: TIdLogfile shows this message when the computer name contains an "_":
"501 Syntactically invalid EHLO argument(s)"

The EHLO command accepts only a valid domain host name or an IP address. A computer name is not always a valid host name, and a '_' character is not allowed in the EHLO command in SMTP, per RFC 5321, Section 2.3.5, Domain Names:

Quote:A domain name (or often just a "domain") consists of one or more components, separated by dots if more than one appears. In the case of a top-level domain used by itself in an email address, a single string is used without any dots. This makes the requirement, described in more detail below, that only fully-qualified domain names appear in SMTP transactions on the public Internet, particularly important where top-level domains are involved. These components ("labels" in DNS terminology, RFC 1035 [2]) are restricted for SMTP purposes to consist of a sequence of letters, digits, and hyphens drawn from the ASCII character set [6]. Domain names are used as names of hosts and of other entities in the domain name hierarchy. For example, a domain may refer to an alias (label of a CNAME RR) or the label of Mail eXchanger records to be used to deliver mail instead of representing a host name. See RFC 1035 [2] and Section 5 of this specification.

The domain name, as described in this document and in RFC 1035 [2], is the entire, fully-qualified name (often referred to as an "FQDN"). A domain name that is not in FQDN form is no more than a local alias. Local aliases MUST NOT appear in any SMTP transaction.

Only resolvable, fully-qualified domain names (FQDNs) are permitted when domain names are used in SMTP. In other words, names that can be resolved to MX RRs or address (i.e., A or AAAA) RRs (as discussed in Section 5) are permitted, as are CNAME RRs whose targets can be resolved, in turn, to MX or address RRs. Local nicknames or unqualified names MUST NOT be used. There are two exceptions to the rule requiring FQDNs:

o The domain name given in the EHLO command MUST be either a primary host name (a domain name that resolves to an address RR) or, if the host has no name, an address literal, as described in Section 4.1.3 and discussed further in the EHLO discussion of Section 4.1.4.

o The reserved mailbox name "postmaster" may be used in a RCPT command without domain qualification (see Section and MUST be accepted if so used.

(04-12-2019, 09:19 AM)Steffen Wrote: Is there a workaround that enables sending IdSMTP mails also from computer names with underscore?

Set the TIdSMTP.HeloName property to whatever value you want, such as the result of the Win32 API GetComputerNameEx() function, which can return a (fully-qualified) domain name for the local computer, if one is available.

If no HeloName is provided, Indy defaults to using the computer's current host name (via TIdStack.HostName), and if no host name is available then it uses the computer's OS name (via IndyComputerName()).


Messages In This Thread
RE: Sending Email by idSMTP from computers with underscore in name - by rlebeau - 04-12-2019, 07:22 PM

Forum Jump:

Users browsing this thread: 1 Guest(s)