gpt4 book ai didi

objective-c - 将 HTML 内容设置为 MFMailComposeViewController View 的邮件正文

转载 作者:行者123 更新时间:2023-12-01 16:00:42 25 4
gpt4 key购买 nike

我正在使用 MessageUI 框架在我的应用程序中撰写电子邮件。我想为邮件正文设置 HTML 内容。

所以我引用了Mugunthkumar's blog我编码如下,

MFMailComposeViewController *picker = [[MFMailComposeViewController alloc] init];
picker.mailComposeDelegate = self;

[picker setSubject:@"Hello from California!"];


// Set up 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];

// Fill out the email body text
NSString *pageLink = @"http://mugunthkumar.com/mygreatapp"; // replace it with yours
NSString *iTunesLink = @"http://link-to-mygreatapp"; // replate it with yours
NSString *emailBody =
[NSString stringWithFormat:@"%@\n\n<h3>Sent from <a href = '%@'>MyGreatApp</a> on iPhone. <a href = '%@'>Download</a> yours from AppStore now!</h3>", @"title", pageLink, iTunesLink];


[picker setMessageBody:emailBody isHTML:YES];

[self presentModalViewController:picker animated:YES];
[picker release];

当我运行应用程序并转到电子邮件撰写 View 时,我收到以下邮件正文,

enter image description here

我正在使用 XCode4 和 iOS 4.3。
我看不到我的代码有任何问题。
但我需要在我的邮件正文中插入可点击的 URL。

请帮忙 !!

最佳答案

如果要发送 HTML 格式的电子邮件,则在电子邮件正文中转义 HTML 标记是错误的。使用</a>而不是 &lt;/a&gt;等等

关于objective-c - 将 HTML 内容设置为 MFMailComposeViewController View 的邮件正文,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10482992/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com