abhishek-ram / pyas2-lib

AS2 Library for building and parsing Messages and MDNs
GNU General Public License v3.0
42 stars 27 forks source link

Enhancement Request - Option to pass domain (fqdn) to build methods for message-id generation #50

Closed robincsamuel closed 2 years ago

robincsamuel commented 2 years ago

it'd be nice if a domain can be an optional argument to the message & mdn build methods. Because the socket.getfqdn() returns the local IP.

Please let me know what do you think. I'll be happy to raise a PR :)

Thanks!

abhishek-ram commented 2 years ago

Maybe I am missing something here, but I do not see a domain in the build methods. Can you point me to that part of the code?

robincsamuel commented 2 years ago

Ah, sorry! I should have mentioned it's about the message-id generation.

The email_utils.make_msgid() method call here accepts an optional domain argument, and fallbacks to socket.getfqdn() as default.

This makes the message-id like 64632159294.1.58385612484174113@ip-172-23-3-37.ec2.internal, but I'm trying to make it like 64632159294.1.58385612484174113@mydomain.com.

So what I am suggesting is, If we can accept an optional domain argument in the build methods, it can be passed to the email_utils.make_msgid() method and the generated message-id will have the custom domain name instead of the local IP address.

robincsamuel commented 2 years ago

@abhishek-ram I've also raised a PR with suggested changes. Please check and share your thoughts :)