Jump to content

Processing incoming emails with a script


Lena

Recommended Posts

The purpose of my account "mail2ftp" is to provide free email-to-FTP service: users can send emails to the email address <mail2ftp @ mail2ftp.heliohost.org> on that account, I had an email forwarder set up in cPanel with forwarding to a pipe:

|/home/mail2ftp/public_html/server/mail2ftp.pl

Incoming emails were processed by that script. After migration today from tommy (cPanel) to johnny (Plesk), the forwarder disappeared, and when I try to set up forwarding to that pipe, Plesk (unlike cPanel) complains "You specified invalid email address: |/home/mail2ftp/public_html/server/mail2ftp.pl."

I tried to set up forwarding as a filter in RoundCube web-mail, same error message.

How can I set up forwarding to a pipe? Or can admin set up this forwarding?

Link to comment
Share on other sites

8 hours ago, Lena said:

/home/mail2ftp/public_html/server/mail2ftp.pl."

One of the changes on Plesk is your home directory is your main domain, not your username. So try this

/home/mail2ftp.heliohost.org/public_html/server/mail2ftp.pl

 

Link to comment
Share on other sites

Again the same error message:
 

Quote

 

You specified invalid email address: |/home/mail2ftp.heliohost.org/public_html/server/mail2ftp.pl.

Specify email addresses. You can type each address on a new line, or separate addresses with white spaces, commas, or semicolons.

 

while trying to set up forwarding on https://johnny.heliohost.org:8443/smb/email-address/edit/id/64 (Plesk - Mail - mail2ftp()mail2ftp.heliohost.org - Forwarding). Instead of being piped to the script, a test email appeared in that mailbox (accessible via Roundcube web-mail), twice for some reason. I tried to find that mailbox (file or dir) among files accessible for CGI scripts on my account - unsuccessfully.

Link to comment
Share on other sites

50 min after the test email message I mentioned above (one line "help" in plain text message body, Subject ignored), I received an email reply from the script, so piping worked. I don't know why the delay (the delay is not because of receiving mailserver, I whitelisted johnny IP-address there). Forwarding isn't visible in Plesk. A copy of the incoming email message is kept in the mailbox, but that's no problem.

johnny.heliohost.org  resolves to 65.19.141.67, but PTR for that IP-address doesn't resolve:

dig -x 65.19.141.67 @8.8.8.8 
...
;; ->>HEADER<<- opcode: QUERY, status: SERVFAIL, id: 23760
...
dig +trace -x 65.19.141.67 
...
67.141.19.65.in-addr.arpa. 86400 IN	CNAME	67.subnet64.141.19.65.in-addr.arpa.
subnet64.141.19.65.in-addr.arpa. 86400 IN NS	ns2.heliohost.org.
subnet64.141.19.65.in-addr.arpa. 86400 IN NS	ns1.heliohost.org.
;; Received 129 bytes from 216.66.1.2#53(ns4.he.net) in 36 ms

dig 67.141.19.65.in-addr.arpa. ptr @ns1.heliohost.org
...
;; ->>HEADER<<- opcode: QUERY, status: REFUSED, id: 13410
...
dig 67.141.19.65.in-addr.arpa. ptr @ns2.heliohost.org
...
;; ->>HEADER<<- opcode: QUERY, status: REFUSED, id: 51684
...

This is bad for emails from johnny.

Thank you.

Link to comment
Share on other sites

Reverse DNS for Johnny has been fixed

root@johnny [/home/krydos]# dig +noall +answer -x 65.19.141.67
67.141.19.65.in-addr.arpa. 86242 IN     CNAME   67.subnet64.141.19.65.in-addr.arpa.
67.subnet64.141.19.65.in-addr.arpa. 14400 IN PTR johnny.heliohost.org.

Thanks for pointing it out.

Link to comment
Share on other sites

Thank you.

Everything worked, but suddenly all my CGI scripts stopped to work. For example, http://mail2ftp.heliohost.org/env.pl gives "500 Internal Server Error", in the log: "End of script output before headers: env.pl". It worked yesterday, I didn't touch that script file, its permissions remain rwx r-x r-x, .htaccess contains:

AddHandler cgi-script .pl

I couldn't find anything suspicious in Plesk. "CGI support" allowed and remains checked. In Apache settings I added in Handlers: "cgi-script .pl" - that didn't help. May be some protection was tripped on my account? I cannot guess why.

Even simpler CGI script http://mail2ftp.heliohost.org/testperl.pl also doesn't work, same 500 Internal Server Error, same in log "End of script output before headers: testperl.pl".

Sorry to bother you.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...