Windows Store (Windows Phone 8.1, Windows 8.1/10, Universal 8.1, Universal 10)
Android
iOS
UTMail is Unity extension allowing developers composing and sending emails directly from C# code. It provides common cross-platform API and works on multiple platforms.
It’s an essential tool for integrating “Contact Support” functionality, and is also a very effective way of getting feedback for beta versions and internal test sessions. It may also be used for automatic or half-automatic reporting on crashes and other events.
Features:
Compose: opens a system email client with a content defined by your app. End-user can then optionally modify the message and send it. The email is sent from the end-user’s email address so you can give them a reply.
Send: uses SMTP to send emails directly, without showing any windows or popups.
SMTP with STARTTLS support on all supported platforms, unlike standard Unity SmtpClient, which makes it work with most modern secure SMTP servers.
Attachments.
Multiple To, Cc and Bcc recipients; Subject, Body, HTML Body and attachments are supported for both composing and sending.
A sample & test scene, which is completely functional even directly in the Unity Editor.
No, currently it’s not supported: you can attach images, but not insert them in the message body (although, you of course can insert images from web with usual HTML tags).
No, it’s impossible, not only because of lack in the UTMail API, but first of all because no modern email servers accept such messages for security reasons.
Most likely, the first overload is what you need, but there are other options as well (first of all the 2nd and 3rd overloads), feel free to choose one which suits your needs the best.
As stated, IsBodyHtml property is not supported when composing on Windows due to the limitations of Windows Messaging API (MAPI) & Universal Windows Platform (UWP) emailing API:
See also remarks to the property in UT.MailMessage class:
Hey @Yuriy-Ivanov thanks for your help, you were right, it was very simple!
You have won a 5 star recommendation from me on the Asset Store!
As a last question: how can I catch errors on sending e-mails (for example if I don’t have Internet connection), to develop a Buffer, that send later the e-mails that couldn’t be sent?
Right now UTMail will just log an exception or an error with either UnityEngine.Debug.LogError or UnityEngine.Debug.LogException (it depends on a platform and a specific issue). F.e. when there is no connection, SocketException would be logged. You can’t really handle that exception without a hook on Unity log (which is possible), as sending is done asynchronously and an exception may happen in a background thread. If you really have to handle that case, you can modify the asset source code to do something else (like store emails which failed to send), see Assets/UniversalTools/UTMail/Src/Mail.cs, lines 113 & 124 and Assets/UniversalTools/UTMail/Src/WSA/UTMailWSAImpl.cs, lines 44 & 50.
In the next update we’re gonna improve error handling on sending emails.
First of all, thank you for using UTMail.
Unfortunately, ReplyTo - is an undocumented setting, available in UTMail API on some platforms due to the way it’s implemented on these platforms. It’s not supported by the asset and won’t even compile if using on other platforms. You might use CC instead, so smtpReplyToAddress would receive an email when replying all. I’m afraid it’s the best you can get currently.
I’m a happy user of UTMail (works like a charm) ! Now I’m wondering how to manage the case where the user does not have an email client configured (because he or she uses webmail only). Do you have any clue ? And first, is UTMail able to detect this situation ?