I am trying to send registration/ activation information via email, but don't want to store my authentication within the vb.net app and therefore not wanting to use .NET SMTP. I have the below php script that works from a website, but I can't seem to get the variables sent to it using the code posted. Any advice with either the .NET code or the php code?
Thanks in advance.
Dim errorString As String = "test string" Dim postData = "errorString=" & errorString Dim request As WebRequest = WebRequest.Create("http://webaddress.com/test.php") request.Method = "POST" Dim byteArray As Byte() = Encoding.UTF8.GetBytes(postData) request.ContentType = "application/x-www-form-urlencoded" request.ContentLength = byteArray.Length Dim dataStream As Stream = request.GetRequestStream() dataStream.Write(byteArray, 0, byteArray.Length) dataStream.Close() Dim response As WebResponse = request.GetResponse() dataStream = response.GetResponseStream() Dim reader As New StreamReader(dataStream) Dim responseFromServer As String = reader.ReadToEnd() reader.Close() dataStream.Close() response.Close() MsgBox(responseFromServer)
<?php $Name = $_REQUEST['Name'] ; $Email = $_REQUEST['Email'] ; $Address = $_REQUEST['Address'] ; $Phone = $_REQUEST['Phone'] ; $Member = $_REQUEST['Member'] ; $Comments = $_REQUEST['Comments'] ; $Message = "Name: $Name\nEmail: $Email\nPhone Number: $Phone\nAddress: $Address\nMember: $Member\nComments: $Comments" ; mail( "email@example.com", "You Have Received a Registration", "Information Requested:\n\n$Message","From: $Email" ); echo "This following information was submitted successfuly.<br>Name: $Name<br>Email: $Email<br>Phone Number: $Phone<br>Address: $Address<br>Member: $Member<br>Comments: $Comments" ; ?>