Got this script on my webpage "www.******.com/mail.php".
This is the script:
<?php
$to = "xxxxxx@gmail.com";
$subject = "Hi!";
$body = "Hi,\n\nHow are you?";
if (mail($to, $subject, $body)) {
echo("<p>Message successfully sent!</p>");
} else {
echo("<p>Message delivery failed...</p>");
}
?>
And when I visit the page, an e-mail gets sent there. But I have a C# program and I want to change &to, &subject and &body in the PHP script.
I have this at the moment:
private void button2_Click(object sender, EventArgs e)
{
try
{
WebClient client = new WebClient();
client.DownloadString("http://xxxxxx/mail.php?to=" + "&to={xxxxxx@gmail.com}" + "&subject={Test}" + "&body={Test}");
client.Dispose();
}
catch (Exception)
{
MessageBox.Show("An error occured loading the scripts, restart it again!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Hand);
}
}
You see, I try to change &to={xxxxxx@gmail.com} and the others, but still the original message gets sent!
The point of this code is, that the C# script will send an e-mail through mail.php. Please help, I would appreciate your time.