dear all

I am looking at using URLRequest and php to configure my app to send an email by sending a post to a form and then the form sending me an email. I have very little understanding of this process and any help would be appreciated. I know this has been discussed here before, but I think my issues are much more basic to previous posts, and I need help.

I have setup a form called phpForm.html with one message field, the html code is as follows:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
        "http://www.w3.org/TR/html4/loose.dtd";>
<html>
<head>
        <title>Untitled</title>
</head>
<body>
<form method="post" action="sendInfo.php">
  Message:<br />
  <textarea name="message" rows="15" cols="40">
  </textarea><br />
  <input type="submit" />
</form>
</body>
</html>

now my code sendInfo.php is:

<?php
  $message = $_REQUEST['message'] ;

  mail( "t...@qu-s.eu", "Test Message", $message );
?>

and this works when I open the page in safari and send the form

now in my code I have the following:

-( IBAction )   sendMail:( id )sender
{
        NSString *post = @"message=testing";
NSData *postData = [post dataUsingEncoding:NSASCIIStringEncoding allowLossyConversion:YES];
        
NSString *postLength = [NSString stringWithFormat:@"%d", [postData length]];
        
NSMutableURLRequest *request = [[[NSMutableURLRequest alloc] init] autorelease]; [request setURL:[NSURL URLWithString:@"http://www.qu-s.eu/ phpForm.html"]];
        [request setHTTPMethod:@"POST"];
        [request setValue:postLength forHTTPHeaderField:@"Content-Length"];
[request setValue:@"application/x-www-form-urlencoded" forHTTPHeaderField:@"Content-Type"];
        [request setHTTPBody:postData];
}

unfortunately nothing seems to happen. Do I have to communicate with the php script directly, and if so how?

Thanks
Reza






_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to