-1

I have very minimal experience with anything web related so apologies if this is a silly question.

I have a Wordpress site with a contact form which users can use to send me a message from the website. The user fills out the form, and it is converted into an email and sent to me.

I would like to have similar functionality from my c# desktop application. In other words, I am looking for a way to either programmatically invoke the contact form on my website, or to send information to my website, which it will convert into an email and send it to me directly.

What general concepts should I be looking into?

Rotem
  • 21,452
  • 6
  • 62
  • 109

1 Answers1

1

The information typed into the web form is probably sent back to the web server using the HTTP POST method. Essentially the data entered into the web form is converted to name values pairs and sent to the WordPress app. More information on HTTP POST here: HTTP POST (Wikipedia)

To do the same from a C# app, you need to format the data to POST in a similar way and then look at using the HttpWebRequest class. This stackoverflow thread shows an example: HTTP request with POST. If you POST the information to the same URL the web page is using then the server should generate the email.

Just to note as well, if the WordPress app requires you to be logged in before submitting the information, then you'll need to include code to authenticate with the WordPress app within the C# app.

I hope this helps!

Community
  • 1
  • 1
BrianB
  • 424
  • 2
  • 13
  • Thanks, that's very helpful. Looking at the code for the contact form I'm currently using, it seems quite complicated. I think it might be simpler to write my own server-side code that converts the POST data into an email. – Rotem Nov 24 '12 at 13:23
  • @Rotem no problem, glad you found it helpful – BrianB Nov 24 '12 at 23:04
  • Turns out the host I'm using (bluehost) has a preinstalled POST-to-email service, which makes this incredibly easy. Thanks again. – Rotem Nov 25 '12 at 13:27