I'm a PHP Laravel developer with no prior experience in Go. I've installed Go version go1.21.6 on Linux/amd64. I am looking to validate emails with domain and MX records using Go.
I've attempted to run go build, go run ., and go run [specific files], but encountered various errors each time.
Could you please guide me through the necessary steps to run this validation process so that I can effectively validate emails?
When using Truemail as my main engine for validating emails I found that every time I validate Yahoo emails the results are always valid/true. After I try to debug the problems, turn out that Yahoo accepts all email addresses in the RCPT TO section, so even if the email doesn't exist the return from the Yahoo MX server will always be OK (250). After I continued to the DATA section in the SMTP session the Yahoo MX server just returned the mailbox not exist message.
Here is the detail:
$ swaks -s mta5.am0.yahoodns.net:25 -f [email protected] -t [email protected]
=== Trying mta5.am0.yahoodns.net:25...
=== Connected to mta5.am0.yahoodns.net.
<- 220 mtaproxy511.free.mail.bf1.yahoo.com ESMTP ready
-> EHLO vpndev.aktiva.co.id
<- 250-mtaproxy511.free.mail.bf1.yahoo.com
<- 250-PIPELINING
<- 250-SIZE 41943040
<- 250-8BITMIME
<- 250 STARTTLS
-> MAIL FROM:<[email protected]><- 250 sender <[email protected]> ok
-> RCPT TO:<[email protected]><- 250 recipient <[email protected]> ok
-> DATA
<- 354 go ahead
-> Date: Tue, 30 Apr 2024 04:24:03 +0000
-> To: [email protected]
-> From: [email protected]
-> Subject: test Tue, 30 Apr 2024 04:24:03 +0000
-> Message-Id: <[email protected]>
-> X-Mailer: swaks v20190914.0 jetmore.org/john/code/swaks/
->
-> This is a test mailing
->
->
->.<** 552 1 Requested mail action aborted, mailbox not found
-> QUIT
*** Remote host closed connection unexpectedly.
So is there any workaround for this problem? I tried various validators that are available online and the result is valid.
Is the only way is just to do/continue the SMTP session until the DATA section? If it is, doesn't it will send the message to the target email if the email is valid?
It is not possible to easily access the content of truemail.validatorResult.SmtpDebug because the fields of smtpRequest are private. How to access easily to these fields ?
I would like to know why smtp check fail by look at SmtpDebug[i].response. Is that a choice to put those structs private ?
The bug is in the runSession function when creating smtp client we ignore the error, however calling either Send or Close in case there is an error causes panic
The bug is in the runSession function when creating smtp client we ignore the error on line 105, however calling either Send or Close in case there is an error causes panic: