-(IBAction)sendButtonPressed
{
[self sendEmailTo:txtTo.text withSubject:txtSubject.text withBody:txtBody.text];
}
-(void)sendEmailTo:(NSString *)to withSubject:(NSString *)subject withBody:(NSString *)body
{
NSString *mailString = [NSString stringWithFormat:@"mailto:?to=%@&subject=%@&body=%@",
[to stringByAddingPercentEscapesUsingEncoding:NSASCIIStringEncoding],
[subject stringByAddingPercentEscapesUsingEncoding:NSASCIIStringEncoding],
[body stringByAddingPercentEscapesUsingEncoding:NSASCIIStringEncoding]];
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:mailString]];
UIAlertView *myAlert=[[UIAlertView alloc] initWithTitle:@"Success" message:@"Email sent" delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil];
[myAlert show];
[myAlert release];
}
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment