I'm trying to manually create a mini mail module with just the user's email address, subject and content of the email. It just serves the purpose for a fast customer support for my app. I also want to hide my email address since i'm just using my gmail account instead of my company's email account. This is to ensure good and timely service since gmail is known for it.
The problem is when i'm sending the 'email' content to my PHP server using:
- (void)sendMail{
NSString *rawStr = [NSString stringWithFormat:@"http://www.somedomain.com/iosuser.php?id=%@__%@__%@__%@",[self getMacAddress],emailAdd.text,subject.text,content.text;];
NSLog(@"%@",rawStr);
NSURL *url = [NSURL URLWithString:rawStr];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:url];
NSURLResponse *response;
NSError *err;
NSData *responseData = [NSURLConnection sendSynchronousRequest:request returningResponse:&response error:&err];
NSLog(@"responseData: %@", responseData);
}
The NSLog for rawStr
works fine, displaying all the contents for the url, email address, subject and the content:
http://www.somedomain.com/iosuser.php?id=C8:2A:14:22:92:E2__test@test.com__SubjectTest__ContentTestContentTestContentTestContentTestContentTestContentTestContentTestContentTestContentTestContentTest
But the NSLog for responseData
returns:
responseData: (null)
so nothing is actually sent.
The emailAdd and subject are UITextField input while the content is from UITextView input. I wonder if UITextView is the problem. Really appreciate any pointers and apologize if this is a foolish issue.
Note:I tried to use the NSLog output of rawStr
on my browser to manually test the script and it works.