WebFaction
Community site: login faq

I'd like to use a mailed inquiry to supply information from my Drupal site. A PHP script would be easiest for me. I wrote a short little php script that just sends me an email if it is run. Works fine if I use its url, but when I use its path for the email script, I get nothing.

Is there a trick to identifying a PHP script to webfaction mail? Is it even doable?

asked 20 Nov '14, 23:43

MichaelM
135
accept rate: 0%

Any program that takes email on stdin should be able to work with mail2script. Can you provide more information about how you're testing it?

For example, if you make a test email message in a file, and pipe it into your script, like this:

/path/to/script.php < /path/to/email.txt

does it work as expected?

(21 Nov '14, 01:55) ryans ♦♦

Good idea.... yes! That works.

Now, to make that work, I needed to add php -f before the line. That's not in my mail settings, so I wonder if that's it....

(21 Nov '14, 02:44) MichaelM

No, you can't add php -f before the line; you need to make that a single executable script.

So, you could do that using a shebang line, like:

#!/usr/local/bin/php

and then

chmod 755 script.php

but you cannot make the command "php -f /path/to/script.php" and have it work with mail2script. It needs to be its own executable file.

(21 Nov '14, 04:42) ryans ♦♦

Thanks to Ryan, and to Dimitari in Rackspace support. Solution was to add the shebang before the PHP.

I'll post the code below.

(21 Nov '14, 21:57) MichaelM

Thanks to Dimitari of Customer SUpport.

The PHP file needs a "shebang" and thus should look like this:

   #!/usr/local/bin/php55

<?php
Your code here.....
permanent link

answered 21 Nov '14, 21:58

MichaelM
135
accept rate: 0%

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×262
×70

question asked: 20 Nov '14, 23:43

question was seen: 1,786 times

last updated: 21 Nov '14, 21:58

WEBFACTION
REACH US
SUPPORT
AFFILIATE PROGRAM
LEGAL
© COPYRIGHT 2003-2020 SWARMA LIMITED - WEBFACTION IS A SERVICE OF SWARMA LIMITED
REGISTERED IN ENGLAND AND WALES 5729350 - VAT REGISTRATION NUMBER 877397162
5TH FLOOR, THE OLD VINYL FACTORY, HAYES, UB3 1HA, UNITED KINGDOM