send email via VB.NET using PHP as the mail processor ?

Hi, i hope u guys would understand what i'm sayin cuz im not sure that i do!
here is what i think i need to do:
i got a very simple PHP mail sender which i want to use with VB.NET (If possible in any way), VB would submit a couple of text fields to the PHP mailer which contains the email that would recieve the email...

If that is not possible, is there any other way i can send mail from VB.NET without having to use SMTP servers...

sorry if i'm not clear enough..

Thank you.
nkrulezAsked:
Who is Participating?
 
BTosonConnect With a Mentor Commented:
Well as you are using VB.NET, anythign you deploy will require the relevant version of the .NET framework to be installed.

See below for namespaced/clarified code.
Dim POSTVariables = New System.Collections.Specialized.NameValueCollection
POSTVariables.Add("email", "e-mailaddresshere")
POSTVariables.Add("name", "name or whatever here")
Dim Request As New WebClient
Dim Result = System.Text.Encoding.UTF8.GetString(Request.UploadValues("http://url/to/mailer.php", POSTVariables))

Open in new window

0
 
BTosonCommented:
Hi,

I'm assuming you have a PHP script hosted somewhere which will you want to call through your VB.NET programme?
If so then why not just use a HTTP POST request?
0
 
nkrulezAuthor Commented:
yah that is pretty much it, but i'm a total newbie to VB.NET
could somebody plz tell me how 2 use HTTP POST request ?
0
Cloud Class® Course: Microsoft Office 2010

This course will introduce you to the interfaces and features of Microsoft Office 2010 Word, Excel, PowerPoint, Outlook, and Access. You will learn about the features that are shared between all products in the Office suite, as well as the new features that are product specific.

 
BTosonCommented:
Simplest way is something like this.  Please don't forget to check your values before submitting them!
Dim POSTVariables = New NameValueCollection
POSTVariables.Add("email", email)
POSTVariables.Add("name", name)
Dim Request As New WebClient
Dim Result = Text.Encoding.UTF8.GetString(Request.UploadValues("http://url/to/mailer.php", POSTVariables))

Open in new window

0
 
BTosonCommented:
Oh and don't forget to put a Imports System.Net in your code behind!
0
 
nkrulezAuthor Commented:
But this way my clients will have to have framework installed in order for the application to work, right ?

I'm not a fan of framework .. is there any other possible way to accomplish this without having to use framework ?

thanks alot.
0
 
nkrulezAuthor Commented:
oh and,

Error1   Type 'NameValueCollection' is not defined.
Error2   Name 'email' is not declared.
Error3   'Encoding' is not a member of 'String'.

0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.