Skip to content

Commit 0435129

Browse files
committed
FIX: used external IP in the SMTP's EHLO message, when domain name is not available
1 parent ec99595 commit 0435129

File tree

2 files changed

+16
-4
lines changed

2 files changed

+16
-4
lines changed

src/boot/sysobj.reb

+1
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ options: object [ ; Options supplied to REBOL during startup
6565
zip: 1
6666
tar: 1
6767
]]
68+
domain-name: none ; Specifies system's domain name (used in SMTP scheme so far)
6869
]
6970

7071
catalog: object [

src/mezz/prot-smtp.reb

+15-4
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ Rebol [
44
type: module
55
author: ["Graham" "Oldes"]
66
rights: BSD
7-
version: 1.0.0
8-
date: 10-May-2022
7+
version: 1.0.1
8+
date: 13-Jul-2022
99
file: %prot-smtp.reb
1010
notes: {
1111
0.0.1 original tested in 2010
@@ -15,6 +15,7 @@ Rebol [
1515
0.0.5 Changed to move credentials to the url or port specification
1616
0.0.6 Fixed some bugs in transferring email greater than the buffer size.
1717
1.0.0 Oldes: Updated to work with my Rebol3 fork; including TLS.
18+
1.0.1 Oldes: Using extenal IP in the EHLO message, when domain-name is not available
1819
1920
Note that if your password does not work for gmail then you need to
2021
generate an app password. See https://support.google.com/accounts/answer/185833
@@ -49,7 +50,7 @@ where's my kibble?}]
4950
host: "smtp.yourisp.com"
5051
user: "joe"
5152
pass: "password"
52-
ehlo: "FQDN" ; if you don't have one, then substitute your IP address
53+
ehlo: "local.domain.name" ; optional, if not available, external IP will be used
5354
] compose [
5455
from: me@somewhere.com
5556
to: recipient@other.com
@@ -404,7 +405,17 @@ sys/make-scheme [
404405
]
405406
spec: port/spec
406407
; create the tcp port and set it to port/state/connection
407-
; unless system/user/identity/fqdn [throw-smtp-error "Need to provide a value for the system/user/identity/fqdn"]
408+
409+
unless spec/ehlo [
410+
unless spec/ehlo: select system/options 'domain-name [
411+
try [
412+
;; resolve external IP and use it as domain name
413+
spec/ehlo: read http://ifconfig.me/ip
414+
;; and store it for later use
415+
put system/options 'domain-name :spec/ehlo
416+
]
417+
]
418+
]
408419
conn: context [
409420
scheme: none
410421
host: spec/host

0 commit comments

Comments
 (0)