im new iphone develoment can 1 helpme in getting sample code in send mail attachment through smtp using iphone.
i have tried sample code following url
http://code.google.com/p/skpsmtpmessage/
thanks
below sample code attach file mail.
mfmailcomposeviewcontroller *picker = [[mfmailcomposeviewcontroller alloc] init]; picker.mailcomposedelegate = self; [picker setsubject:@"hello"]; // set recipients nsarray *torecipients = [nsarray arraywithobject:@"first@example.com"]; nsarray *ccrecipients = [nsarray arraywithobjects:@"second@example.com", @"third@example.com", nil]; nsarray *bccrecipients = [nsarray arraywithobject:@"fourth@example.com"]; [picker settorecipients:torecipients]; [picker setccrecipients:ccrecipients]; [picker setbccrecipients:bccrecipients]; // attach image email nsstring *path = [[nsbundle mainbundle] pathforresource:@"rainy" oftype:@"png"]; nsdata *mydata = [nsdata datawithcontentsoffile:path]; [picker addattachmentdata:mydata mimetype:@"image/png" filename:@"myfile"]; // fill out email body text nsstring *emailbody = @"message body : first email sending "; [picker setmessagebody:emailbody ishtml:no]; [self presentmodalviewcontroller:picker animated:yes]; [picker release];
Comments
Post a Comment