TheFox / smtpd

SMTP server (library) for receiving emails, written in pure PHP.
https://fox21.at
MIT License
121 stars 30 forks source link

Attachments #12

Open drkhunter opened 6 years ago

drkhunter commented 6 years ago

Hey, do you have any plans to implement support for email attachments, or give some clues as to how this might be done?

TheFox commented 6 years ago

Where exactly do you mean? The attachments are handled by Zend\Mail\Message.

drkhunter commented 6 years ago

I couldn't find attachment methods within Zend\Mail\Message, looks like it might have been moved to zend-mime?

I was trying to get the attachments and store them within the daemon script, but the zend message object wasn't giving me anything to work with.

To get around it I forked the repo to add https://github.com/php-mime-mail-parser/php-mime-mail-parser

Any clues?

TheFox commented 6 years ago

I don't want do use Zend Message anyway, because the codebase of Zend is bad. Too many bugs.

I'll consider to replace Zend Message with something better for v0.8 release. Thank you for your contribution.

drkhunter commented 6 years ago

No problem. Looking forward to seeing what you go with.

groovenectar commented 2 years ago

@drkhunter One solution is on this line:

https://github.com/TheFox/smtpd/blob/master/src/Client.php#L473

Replace:

$zmail = Message::fromString($this->mail);

With:

$zmail = \Zend\Mime\Message::createFromMessage($this->mail)

Also need to change the method signature here (and in your implementation):

https://github.com/TheFox/smtpd/blob/master/src/Server.php#L344

Then the message parts should be accessible...

Also a suggestion for a Zend\Mime/Zend\Message alternative here: https://github.com/TheFox/smtpd/issues/20