通过电子邮件发送应用程序中的图像

时间:2022-11-13 12:12:38

What's the best way of sending an email with an image from the application to the Mail.app for someone to send to any contact they like?

将带有图像的电子邮件从应用程序发送到Mail.app以便有人发送给他们喜欢的任何联系人的最佳方法是什么?

For example, in my app (iMood), you can select a 'mood', I'd like the user to be able to email this to a friend for example, by using a button in the navigation bar.

例如,在我的应用程序(iMood)中,您可以选择“情绪”,我希望用户能够通过导航栏中的按钮将其通过电子邮件发送给朋友。

I can easily create the button etc. but just need to know a way to enable the user to send the image (ie. image.png) from the project to Mail.app as maybe an attachment or a picture in the email.

我可以轻松创建按钮等,但只需要知道一种方法,使用户能够将图像(即。image.png)从项目发送到Mail.app,可能是电子邮件中的附件或图片。

Thanks in advance.

提前致谢。

2 个解决方案

#1


It's possible and David J. Hinson has written a good blog entry about it here

这是可能的,David J. Hinson在这里写了一篇很好的博客文章

#2


This question has been answered many times and in many different forms.

这个问题已经多次回答,并且有许多不同的形式。

Short answer: you can't. There is no API that allows you access to Mail attachments, and Apple's implementation of the mail URL scheme does not support attachments either.

简答:你不能。没有允许您访问邮件附件的API,Apple的邮件URL方案实现也不支持附件。

To accomplish this, you have a couple of very unattractive options:

要做到这一点,你有几个非常不吸引人的选择:

1) Build-in your own SMTP client. There are some Open Source libraries that are working toward this, but it's still a pain

1)内置您自己的SMTP客户端。有一些开源库正在为此努力,但它仍然是一个痛苦

2) Send the image to a third part server (yours) and compose and send the mail from there. Users probably won't like the possibility you collecting email addresses for nefarious purposes.

2)将图像发送到第三方服务器(您的)并撰写并从那里发送邮件。用户可能不喜欢您为恶意目的收集电子邮件地址的可能性。

In your case, the best thing to do is save the image to the Photo Library. From there, users can send email with the photo.

在您的情况下,最好的办法是将图像保存到照片库。用户可以从那里发送包含照片的电子邮件。

If you'd like to see Apple enable email attachments, please file a request.

如果您希望Apple启用电子邮件附件,请提交请求。

#1


It's possible and David J. Hinson has written a good blog entry about it here

这是可能的,David J. Hinson在这里写了一篇很好的博客文章

#2


This question has been answered many times and in many different forms.

这个问题已经多次回答,并且有许多不同的形式。

Short answer: you can't. There is no API that allows you access to Mail attachments, and Apple's implementation of the mail URL scheme does not support attachments either.

简答:你不能。没有允许您访问邮件附件的API,Apple的邮件URL方案实现也不支持附件。

To accomplish this, you have a couple of very unattractive options:

要做到这一点,你有几个非常不吸引人的选择:

1) Build-in your own SMTP client. There are some Open Source libraries that are working toward this, but it's still a pain

1)内置您自己的SMTP客户端。有一些开源库正在为此努力,但它仍然是一个痛苦

2) Send the image to a third part server (yours) and compose and send the mail from there. Users probably won't like the possibility you collecting email addresses for nefarious purposes.

2)将图像发送到第三方服务器(您的)并撰写并从那里发送邮件。用户可能不喜欢您为恶意目的收集电子邮件地址的可能性。

In your case, the best thing to do is save the image to the Photo Library. From there, users can send email with the photo.

在您的情况下,最好的办法是将图像保存到照片库。用户可以从那里发送包含照片的电子邮件。

If you'd like to see Apple enable email attachments, please file a request.

如果您希望Apple启用电子邮件附件,请提交请求。