postal icon indicating copy to clipboard operation
postal copied to clipboard

530 From/Sender name is not valid

Open xpresservers opened this issue 7 years ago • 18 comments

Hi,

I have configured postal on a linode machine and from command line I am able to send the test message but unable to send it using SMTP credentials. It always gives me 530 From/Sender name is not valid. Tried searching here without any luck.

image

image

Postal Status

`Procodile Version 1.0.23 Application Root /opt/postal/app Supervisor PID 2326 Started 2019-08-03 20:01:51 +0000

|| web || Quantity 1 || Command bundle exec puma -C config/puma.rb || Respawning 5 every 3600 seconds || Restart mode usr1 || Log path none specified || Address/Port none || => web.1 Running 03/08/2019 pid:2332 respawns:0 port:- tag:-

|| worker || Quantity 1 || Command bundle exec ruby script/worker.rb || Respawning 5 every 3600 seconds || Restart mode start-term || Log path none specified || Address/Port none || => worker.5 Running 22:54 pid:3634 respawns:0 port:- tag:-

|| cron || Quantity 1 || Command bundle exec rake postal:cron || Respawning 5 every 3600 seconds || Restart mode term-start || Log path none specified || Address/Port none || => cron.5 Running 22:54 pid:3645 respawns:0 port:- tag:-

|| smtp || Quantity 1 || Command bundle exec rake postal:smtp_server || Respawning 5 every 3600 seconds || Restart mode usr1 || Log path none specified || Address/Port none || => smtp.1 Running 22:55 pid:3637 respawns:0 port:- tag:-

|| requeuer || Quantity 1 || Command bundle exec rake postal:requeuer || Respawning 5 every 3600 seconds || Restart mode term-start || Log path none specified || Address/Port none || => requeuer.5 Running 22:54 pid:3644 respawns:0 port:- tag:-`

netstat -lnp

Active Internet connections (only servers) Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name tcp 0 0 127.0.0.1:5000 0.0.0.0:* LISTEN 2332/[postal] web.1 tcp 0 0 0.0.0.0:25672 0.0.0.0:* LISTEN 22569/beam tcp 0 0 127.0.0.1:3306 0.0.0.0:* LISTEN 23431/mysqld tcp 0 0 127.0.0.1:783 0.0.0.0:* LISTEN 22255/perl tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 2366/nginx: worker tcp 0 0 0.0.0.0:4369 0.0.0.0:* LISTEN 22648/epmd tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 1396/sshd tcp 0 0 0.0.0.0:443 0.0.0.0:* LISTEN 2366/nginx: worker tcp6 0 0 :::5672 :::* LISTEN 22569/beam tcp6 0 0 ::1:783 :::* LISTEN 22255/perl tcp6 0 0 :::80 :::* LISTEN 2366/nginx: worker tcp6 0 0 :::4369 :::* LISTEN 22648/epmd tcp6 0 0 :::22 :::* LISTEN 1396/sshd tcp6 0 0 :::25 :::* LISTEN 3637/[postal] smtp. tcp6 0 0 :::443 :::* LISTEN 2366/nginx: worker udp 0 0 0.0.0.0:15241 0.0.0.0:* 2332/[postal] web.1 Active UNIX domain sockets (only servers) Proto RefCnt Flags Type State I-Node PID/Program name Path unix 2 [ ACC ] STREAM LISTENING 15904 1425/systemd /run/user/0/systemd/private unix 2 [ ACC ] SEQPACKET LISTENING 9705 1/systemd /run/udev/control unix 2 [ ACC ] STREAM LISTENING 12540 1/systemd /var/run/dbus/system_bus_socket unix 2 [ ACC ] STREAM LISTENING 23909 1/systemd /run/snapd-snap.socket unix 2 [ ACC ] STREAM LISTENING 12553 1/systemd /run/acpid.socket unix 2 [ ACC ] STREAM LISTENING 12530 1/systemd /var/lib/lxd/unix.socket unix 2 [ ACC ] STREAM LISTENING 19799 1/systemd /run/systemd/private unix 2 [ ACC ] STREAM LISTENING 23908 1/systemd /run/snapd.socket unix 2 [ ACC ] STREAM LISTENING 46728 23431/mysqld /var/run/mysqld/mysqld.sock unix 2 [ ACC ] STREAM LISTENING 9695 1/systemd /run/lvm/lvmpolld.socket unix 2 [ ACC ] STREAM LISTENING 9706 1/systemd /run/systemd/fsck.progress unix 2 [ ACC ] STREAM LISTENING 9707 1/systemd /run/lvm/lvmetad.socket unix 2 [ ACC ] STREAM LISTENING 9709 1/systemd /run/systemd/journal/stdout unix 2 [ ACC ] STREAM LISTENING 14131 1197/iscsid @ISCSIADM_ABSTRACT_NAMESPACE unix 2 [ ACC ] STREAM LISTENING 53286 2326/app) /tmp/postal/pids/procodile.sock

xpresservers avatar Aug 06 '19 23:08 xpresservers

Which credentials are you using? Your local one or one from the UI? also what port are you trying to operating on?

DTS-Mike avatar Aug 06 '19 23:08 DTS-Mike

I generated the credentials from https://domain.tld/org/first-org/servers/postal/help/outgoing page. My username is first-org/postal and a randomly generated password. I am using port 25 since port 2525 is not working (I believe it is closed in iptables)

xpresservers avatar Aug 06 '19 23:08 xpresservers

I am able to send test email from terminal.

postal test-app-smtp hafizlatif*@***.com Message has been sent successfully.

xpresservers avatar Aug 06 '19 23:08 xpresservers

The error message means that the "From" email address you are using does not include a domain which has been added to the Postal server that has the credential on it.

Either you haven't added the domain or there is a minor coding problem. See #728 for a similar situation.

willpower232 avatar Aug 07 '19 08:08 willpower232

The error message means that the "From" email address you are using does not include a domain which has been added to the Postal server that has the credential on it.

Either you haven't added the domain or there is a minor coding problem. See #728 for a similar situation.

I tried it on a subdomain of same domain name as well as a different domain. Same error on both installations of my marketing software

xpresservers avatar Aug 07 '19 11:08 xpresservers

Does the domain name match what is listed on the Domains page in Postal?

It might also be that your marketing software is using the Sender header so you could try turning that on in the settings.

willpower232 avatar Aug 07 '19 12:08 willpower232

yes, the root domain is same. (postal is configured on mail.domain.tld and interspire email marketer on email.domain.tld). I am using interspire email marketer

xpresservers avatar Aug 07 '19 12:08 xpresservers

The root domain may be the same but I think you need to add both mail.domain.tld and email.domain.tld to Postal.

willpower232 avatar Aug 07 '19 13:08 willpower232

Can't we bypass this? Because this thing kills the purpose of SMTP server

xpresservers avatar Aug 07 '19 13:08 xpresservers

Not without numerous changes throughout the code.

Also Postal requiring the domains to be added to it helps guarantee delivery by testing the DNS records that the recipients email server will use to verify the mail it receives from Postal.

If you want a more accepting email sending server, you should look at something more traditional like Postfix or Exim but those will require more effort to set up than adding two domains to Postal.

willpower232 avatar Aug 07 '19 13:08 willpower232

The same domain has been added and DNS configured properly but it is still generating the same error.

xpresservers avatar Aug 07 '19 15:08 xpresservers

The cause of that error is simply that the credential you are using doesn't match the domains.

If you've added all the subdomains you're using into the same Postal organisation or server as the credential then it should be working. There is no other cause.

willpower232 avatar Aug 08 '19 12:08 willpower232

Make sure you specify From: address in your email correctly. I had similar troubles when sending from python code using smtplib.

shinebayar-g avatar Sep 05 '19 10:09 shinebayar-g

I believe this check can be disabled. There is a "send as any" option somewhere.

catphish avatar Nov 24 '19 14:11 catphish

Indeed it seems that the "Send As Any" option doesn't make any difference. Whether it's enabled or disabled, unless you have added the sending domains to the domains list, you will get the "530 From/Sender name is not valid".

I'm trying to setup Postal as a smarthost/relay for cPanel servers (they run Exim), and "Send As Any" has no effect. Adding all domains of several shared hosting servers is clearly not possible, so the "Send As Any" option should have done the trick in such cases, but it's not working as expected.

georgetasioulis avatar Mar 09 '20 19:03 georgetasioulis

Thank you for testing. We can check this and confirm whether there's a bug here.

catphish avatar Mar 10 '20 10:03 catphish

Great thanks. Let me share my use case just fyi.

I'm trying to use Postal as an SMTP relay for my own cPanel servers. I'm using services like MailChannels or SpamExperts Outbound in the same manner. To configure cPanel's Exim to relay all email through the relay/smarthost I use the standard configuration entries that works on both devices mentioned earlier. Sample configurations can be found here:

https://mailchannels.zendesk.com/hc/en-us/articles/200262710-Setting-up-for-cPanel https://documentation.solarwindsmsp.com/spamexperts/documentation/Content/B_Admin%20Level/outgoing-filtering/cpanel-whm-user-auth.htm

Using the above examples, I've configured a cPanel server to relay mail through a test Postal server I've setup. I changed client_send and route_list entries accordingly, setup an Organization and a Mailserver in Postal, and went into one of the cPanel server's domains webmail to send a test email.

First attempt got me a "530 From/Sender name is not valid" mail delivery error. I googled a bit, found about the "Send As Any" option, went to Settings > Advanced Settings and set "Allow Sender Header" to Yes - Can Use Sender header (which also changed the "Send As Any" option in Settings > Server Settings to "Enabled"), saved and tried again. Same "530 From/Sender name is not valid" mail delivery error. Then I went to Domains, added the domain from which I was sending from and tried again. Mail went through without an issue! Then I switched "Allow Sender Header" to No (which changed "Send As Any" to Disabled) and tried again. Again, the email went through without an issue. Then I tried from a different domain's webmail (same cPanel server obviously), again "530 From/Sender name is not valid". Re-enabled "Allow Sender Header" so that "Send As Any" gets Enabled, again, same "530 From/Sender name is not valid" error. Once I added that second domain to the Domains list, email went through. Again, whether "Send As Any" was Enabled or Disabled didn't matter as long as the Domain was in the list.

So my Exim configuration looked fine since I managed to get some mail sent through Postal, however, regardless of the "Allow Sender Header" and "Send As Any" configuration (Yes/No, Enabled/Disabled), email would not get through unless I added the domain from which I was sending, to the Domains list in the Mailserver in Postal.

Expected result: to be able to send from whatever domain is hosted on the cPanel server without having to add it to the "Domains" list, when the "Send As Any" option is set to Enabled.

georgetasioulis avatar Mar 10 '20 18:03 georgetasioulis

@georgetasioulis have you tried adding the "Sender" header to the message?

If using the /send/message API: from: [email protected] sender: [email protected] to: [email protected]

Or if using the /send/raw API: mail_from: [email protected] rcpt_to: [email protected] data: base64 encoded raw message that includes BOTH the from header (can be @anydomain.com) and the sender header ([email protected])

SPF checks the mail_from aka "envelope from" so that has to be yourdomain.com.

timraybould avatar Apr 07 '20 17:04 timraybould