我们正在经营文具业务,并为人们设计电子邮件文具,签名等.在PC上使用它们没有问题,因为在大多数邮件客户端中将HTML添加到电子邮件内容很容易.但是,iOS可以实现吗?
我们现在如何为移动设备做这件事是我们告诉用户添加我们的SMTP服务器并通过它发送消息.这个SMTP的工作原理是它在发送前用HTML包装每封电子邮件.我想知道这是否可以直接在iPhone上进行,并在发送之前对电子邮件进行某种后处理?
Mag*_*ave 11
AFAIK您无法捕获从内置电子邮件客户端发送的电子邮件.但是,您可以编写自己的应用程序,使用HTML发送带有HTML的电子邮件MFMailComposeViewController.
编辑:添加了一些示例代码:
- (void) sendEventInEmail
{
MFMailComposeViewController *picker = [[MFMailComposeViewController alloc] init];
picker.mailComposeDelegate = self;
[picker setSubject:@"Email Subject"];
// Fill out the email body text
NSString *iTunesLink = @"http://itunes.apple.com/gb/app/whats-on-reading/id347859140?mt=8"; // Link to iTune App link
NSString *content = [eventDictionary objectForKey:@"Description"];
NSString *imageURL = [eventDictionary objectForKey:@"Image URL"];
NSString *findOutMoreURL = [eventDictionary objectForKey:@"Link"];
NSString *emailBody = [NSString stringWithFormat:@"<br /> <a href = '%@'> <img src='%@' align=left style='margin:5px' /> </a> <b>%@</b> <br /><br />%@ <br /><br />Sent using <a href = '%@'>What's On Reading</a> for the iPhone.</p>", findOutMoreURL, imageURL, emailSubject, content, iTunesLink];
[picker setMessageBody:emailBody isHTML:YES];
[self presentModalViewController:picker animated:YES];
[picker release];
}
- (void)mailComposeController:(MFMailComposeViewController*)controller didFinishWithResult:(MFMailComposeResult)result error:(NSError*)error
{
// Notifies users about errors associated with the interface
switch (result)
{
case MFMailComposeResultCancelled:
break;
case MFMailComposeResultSaved:
break;
case MFMailComposeResultSent:
break;
case MFMailComposeResultFailed:
break;
default:
break;
}
[self dismissModalViewControllerAnimated:YES];
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
11179 次 |
| 最近记录: |