不使用 MFMailComposeViewController 发送电子邮件

发布于 2024-12-29 07:02:05 字数 111 浏览 0 评论 0原文

是否可以在iOS中发送电子邮件而不依赖于系统默认的邮件/消息传递接口?这与消息传递真的一样吗,您不能为消息创建自定义界面,而是使用 MFMessageComposerViewController 的默认界面?

Is it possible to send email in iOS without relying on the default mail / messaging interface of the system? Does it really the same with messaging where you can not create your custom interface for message but to use the default interface of MFMessageComposerViewController?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

撑一把青伞 2025-01-05 07:02:05

看看这个答案。

锁定 MFMailComposeViewController 中的字段

如果按照说明操作,您可以创建您的自己的自定义视图然后发送电子邮件。无需使用默认的 MFMessageCompserViewController 。

Take a look at this answer.

Locking the Fields in MFMailComposeViewController

If you follow the instructions you can create your own custom View then send email. Without having to use the default MFMessageCompserViewController .

甜`诱少女 2025-01-05 07:02:05

如果您想使用设备的电子邮件帐户设置,则需要使用 MFMessageComposerViewControllermailto: 网址来打开 Mail.app。

If you want to use the email account setup for the device, you'll need to use MFMessageComposerViewController or a mailto: url to open Mail.app.

鸠书 2025-01-05 07:02:05

SendGrid 库允许用户从 ios 应用程序发送电子邮件,无需 MFMailComposer
https://sendgrid.com/blog/send -email-in-ios-with-new-sendgrid-library/

以下是如何使用 iOS 发送电子邮件的基本代码:

//create Email Object
sendgrid *msg = [sendgrid user:@"ApiUser" andPass:@"ApiKey"];

//set parameters
msg.subject = @"email subject";
msg.tolist = @[@"[email protected]", @"[email protected]"];
msg.from = @"[email protected]";
msg.text = @"hello world";
msg.html = @"<html><body><h1>hello world</h1></body></html>";

//adding unique arguments (Optional)
NSDictionary *uarg = @{@"customerAccountNumber":@"55555",
                       @"activationAttempt": @"1"};
[msg addCustomHeader:uarg withKey:@"unique_args"];

//adding categories (Optional)
NSString *replyto = @"billing_notifications";
[msg addCustomHeader:replyto withKey:@"category"];

//Image attachment (Optional)
[msg attachImage:self.photo];

//Send email through Web API Transport
[msg sendWithWeb];

SendGrid library allows user to send email from an ios app without MFMailComposer
https://sendgrid.com/blog/send-email-in-ios-with-new-sendgrid-library/

Here’s the basic code for how you can send email with iOS:

//create Email Object
sendgrid *msg = [sendgrid user:@"ApiUser" andPass:@"ApiKey"];

//set parameters
msg.subject = @"email subject";
msg.tolist = @[@"[email protected]", @"[email protected]"];
msg.from = @"[email protected]";
msg.text = @"hello world";
msg.html = @"<html><body><h1>hello world</h1></body></html>";

//adding unique arguments (Optional)
NSDictionary *uarg = @{@"customerAccountNumber":@"55555",
                       @"activationAttempt": @"1"};
[msg addCustomHeader:uarg withKey:@"unique_args"];

//adding categories (Optional)
NSString *replyto = @"billing_notifications";
[msg addCustomHeader:replyto withKey:@"category"];

//Image attachment (Optional)
[msg attachImage:self.photo];

//Send email through Web API Transport
[msg sendWithWeb];
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文