zendframework / zend-mail

Mail component from Zend Framework
BSD 3-Clause "New" or "Revised" License
96 stars 111 forks source link

SMTP protocol: error in function rcpt ? #178

Open MadCat34 opened 6 years ago

MadCat34 commented 6 years ago

Hi, First: sorry if my english is not perfect :-)

In my company, a project (currently in development) is using Zend\Mail with SMTP protocol to send email

When a mail is sent with multiple recipients (to, cc and bcc), the SMTP server checks email addresses, return a error code 550 5.1.1 if one doesn't exists and a exception is thrown by Zend\Mail\Protocol\Smtp => and the email is not send at all

BUT, in RFC (RFC 2821), it is said:

The second step in the procedure is the RCPT command. RCPT TO: [ SP ]

The first or only argument to this command includes a forward-path (normally a mailbox and domain, always surrounded by "<" and ">" brackets) identifying one recipient. If accepted, the SMTP server returns a 250 OK reply and stores the forward-path. If the recipient is known not to be a deliverable address, the SMTP server returns a 550 reply, typically with a string such as "no such user - " and the mailbox name (other circumstances and reply codes are possible). This step of the procedure can be repeated any number of times.

https://github.com/zendframework/zend-mail/blob/master/src/Transport/Smtp.php#L224-L261 https://github.com/zendframework/zend-mail/blob/master/src/Protocol/Smtp.php#L285-L294 https://github.com/zendframework/zend-mail/blob/master/src/Protocol/AbstractProtocol.php#L326-L354

The email should be sent

Is it a problem in the smtp implementation ?

What do you think ?

I did a test with TELNET.

Connected to XXXXXXXXXXX
Escape character is '^]'.
220 xx.xxxxx.xx ESMTP (Ubuntu)
EHLO
501 Syntax: EHLO xxxxxx
EHLO xxxx
250-xx.xxxxx.xx
250-PIPELINING
250-SIZE 10240000
250-VRFY
250-ETRN
250-STARTTLS
250-ENHANCEDSTATUSCODES
250-8BITMIME
250 DSN
VRFY xxxx@xxxxx.xx
252 2.0.0 xxxx@xxxxx.xx
VRFY yyyy@xxxxx.xx
550 5.1.1 <yyyy@xxxxx.xx>: Recipient address rejected: User unknown in local recipient table
MAIL FROM: xxxxx@xxxxx.xxx
250 2.1.0 Ok
RCPT TO: xxxx@xxxxx.xx
250 2.1.5 Ok
RCPT TO: zzzz@xxxxx.xx
550 5.1.1 <zzzz@xxxxx.xx>: Recipient address rejected: User unknown in local recipient table
data
354 End data with <CR><LF>.<CR><LF>
Subject: test

Test
.
250 2.0.0 Ok: queued as 29AD1D60596
quit
221 2.0.0 Bye
Connection closed by foreign host.

=> some recipients in error BUT email is sent

michalbundyra commented 4 years ago

This repository has been closed and moved to laminas/laminas-mail; a new issue has been opened at https://github.com/laminas/laminas-mail/issues/41.