使用预定义的电子邮件地址从 iPhone 发送电子邮件
我想让用户可以发送来自预定义电子邮件地址的电子邮件地址。因此用户没有指定电子邮件地址。
但是,我希望他们能够定义收件人的电子邮件和电子邮件地址的内容。
这是我之前尝试使用的,它通过邮件客户端:
NSString *emailInfo = [NSString stringWithString: @"mailto:[email protected]&subject=SUBJECT"];
[[UIApplication sharedApplication] openURL: [NSURL URLWithString: emailInfo]];
问题是,我想让它如此 MAIL & SUBJECT 类似于 UITextFields 中使用的 toEmail
和 content
变量。
我尝试使用 stringWithFormat
但它不起作用。
有什么想法吗?
谢谢
I'd like to make it so the user can send an email address which comes from a predefined email address. So the user does not specify the email address.
However, I'd like it so they do define the recipient's email and the content of the email address.
This is what I tried using earlier, which goes through the Mail client:
NSString *emailInfo = [NSString stringWithString: @"mailto:[email protected]&subject=SUBJECT"];
[[UIApplication sharedApplication] openURL: [NSURL URLWithString: emailInfo]];
The thing is, I want to make it so MAIL & SUBJECT resemble the toEmail
and content
variables which are used in UITextFields.
I tried using stringWithFormat
but it didn't work.
Any ideas?
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
尝试
Try
错误的可能原因是 NSURL 对象:
我猜
[NSURL URLWithString: emailInfo]
返回 null。尝试打印到控制台
所以我建议您进行字符串编码。
Probable cause of error is NSURL object:
I guess
[NSURL URLWithString: emailInfo]
is returning null.Try printing to console
So I would suggest you to go for string encoding.