0

I am looking to set up one PHP file to sort and respond to emails. It is sort of a subscription-based email alert system.

So I need script that will check the body content of an email, then respond to the email with some small amount of plain text.

For example: Email from user = A Email from server = B

B: Thank you for your subscription! Reply YES to confirm or CANCEL. A: YES B: You've been added to the list.

Then I would also need code to add email address to a mailing list and also code to remove email from mailing list.

I am using cPanel to create mailing list and set up a filtering system which only allows Pipe to Program, no respond with templates.

I have researched the topic, but there are not that many references anywhere on this type of coding.


MAIN FOCUS:

  • If body of email contains "XXX" then respond with body only "YYY".
  • If body of email contains "XXX" then add email to mailing list and respond with body only "YYY".
4
  • Since you're question is sort of general, I'll point you toward this answer on Mail_mimeDecode The PHP script's logic to send emails based on the input, I leave to you because it is fairly simple logic. Parsing the input message is the hard part. Commented Feb 12, 2015 at 0:24
  • 1
    There is also this answer which focuses on the text body content of MIME messages with string parsing. Commented Feb 12, 2015 at 0:30
  • @MichaelBerkowski I am so lost, this part of PHP is out of my range. So I want to read emails from the server, which is the first part of the code, I understand that, but then let's say, the body of the email is "YES" and the subject is "SUB_CONFIRM", then I want to respond to the email with "Thank You" excluding all headers, just "Thank You" in the body. But also if the email says something else with another subject, respond with something else. IN addition, add email address to a mailing list. Commented Feb 12, 2015 at 0:39
  • Assembling the logic is manyfold. Start with PHPMailer for an easy path to send messages. I don't recommend trying to use the built-in mail() function. When you have read the body into a var $body using one of the linked methods, conditional logic like if ($body == 'YES') {// simple Thank You response} PHPMailer's readme file has an excellent starting example. Commented Feb 12, 2015 at 4:52

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.