我尝试使用自定义内容类型从应用发送电子邮件。
任何想法如何做到这一点?
所以我想改变
“内容类型”: “multipart / mixed; boundary = Apple-Mail-1--209662383” - > “application / pkcs7-mime; name = smime.p7m; smime-type = enveloped-data”
和 “内容传输编码”:
“7bit” - > “BASE64”
答案 0 :(得分:1)
我使用http://code.google.com/p/skpsmtpmessage/向iOS发送自定义邮件。
答案 1 :(得分:-1)
(void)launchInAppMail {
MFMailComposeViewController * controller = [[MFMailComposeViewController alloc] init];
controller.mailComposeDelegate = self;
[controller setSubject:@“在app email ...”];
NSMutableString * messageString = [[NSMutableString alloc] init];
if(!(mNameField.text == nil || [mNameField.text isEqualToString:@“”])){
[messageString appendFormat:@"Name: %@ \n",mNameField.text];
} if(!(mPhoneNumberField.text == nil || [mPhoneNumberField.text isEqualToString:@“”])) { [messageString appendFormat:@“电话号码:%@ \ n”,mPhoneNumberField.text];
}
if(!(mEmailField.text == nil || [mEmailField.text isEqualToString:@“”])){ [messageString appendFormat:@“电子邮件ID:%@ \ n”,mEmailField.text]; }
if(!(mTextView.text == nil || [mTextView.text isEqualToString:@“”])){
[messageString appendFormat:@"Desription: %@ \n",mTextView.text];
}
if(!(mProblemNameButton.titleLabel.text == nil || [mProblemNameButton.titleLabel.text isEqualToString:@“”])){
[messageString appendFormat:@"Problem Name: %@ \n",mProblemNameButton.titleLabel.text];
}
[messageString appendFormat:@“Address:%@ \ n”,self.mAddress];
if(self.coordinateLoc)
[messageString appendFormat:@"Longitude: %f, Latitude: %f \n", self.coordinateLoc.coordinate.longitude, self.coordinateLoc.coordinate.latitude];
[controller setToRecipients:[NSArray arrayWithObject:@“service@emergencylocksmithleads.com”]];
[controller setMessageBody:messageString isHTML:NO];
[messageString release];
if(mImageView.image!= nil){
NSData *imageData = UIImageJPEGRepresentation(mImageView.image, 1);
[controller addAttachmentData:imageData mimeType:@"image/jpg" fileName:@"example.jpg"];
}
[self presentModalViewController:controller animated:YES];
[控制器发布]; }