12-21-2023, 10:01 AM
I created a Subversion commit mailer back in 2018 using FPC/Lazarus and Indy 10 and it has been working ok up until recently when it has had all kinds of problems due to email security updates on mail servers etc.
So I am trying to move away from sending the emails out from the subversion server to have it post to a php script on my webserver instead. Then the script can send the report emails to the recipients.
The existing application uses TIdSMTP to send the message, which is written into a TIdMessage property by a composing function reading data from the svn server.
Now I want to have a similar function but instead of using the SMTP mail transfer it should POST the data to a php script which should do the mailing from there. I have so far no problems sending emails from that server.
But it is on an ISP so I cannot run anything else but web-server stuff there. Hence the php script for mailing.
So how can I use Indy10 to simulate a form submit using the POST method to send the data the script will need?
This is what I need to send:
- Sender name and email as a single line string
- Recipients list in name/email pairs as a single line string
- Message body as an html encoded multi-line text
These are already created in the current application but stuffed into a TIdMessage container used by TIdSMTP.
I can create the website php script as a form handler and use it to send the needed data from an html form with the following items:
method POST
From, To : text type inputs
Message: textarea
Submit button
What I want to do is send the data from my application the same way as how the user clicking submit would do.
How can that be done?
Which Indy10 component to use and how do I set it up to perform the POST operation?
So I am trying to move away from sending the emails out from the subversion server to have it post to a php script on my webserver instead. Then the script can send the report emails to the recipients.
The existing application uses TIdSMTP to send the message, which is written into a TIdMessage property by a composing function reading data from the svn server.
Now I want to have a similar function but instead of using the SMTP mail transfer it should POST the data to a php script which should do the mailing from there. I have so far no problems sending emails from that server.
But it is on an ISP so I cannot run anything else but web-server stuff there. Hence the php script for mailing.
So how can I use Indy10 to simulate a form submit using the POST method to send the data the script will need?
This is what I need to send:
- Sender name and email as a single line string
- Recipients list in name/email pairs as a single line string
- Message body as an html encoded multi-line text
These are already created in the current application but stuffed into a TIdMessage container used by TIdSMTP.
I can create the website php script as a form handler and use it to send the needed data from an html form with the following items:
method POST
From, To : text type inputs
Message: textarea
Submit button
What I want to do is send the data from my application the same way as how the user clicking submit would do.
How can that be done?
Which Indy10 component to use and how do I set it up to perform the POST operation?