Sending an email with an attachment

I’m looking for a simple way to send an email of a screenshot taken of the game using a the email address the user provides in a prompt.
Note this is for a standalone build.

I’ve tried using “mailto” , but this does not work with attachments (security issue).
I’m unsure if prime31’s stuff works with standalone builds.

I’ve also found this script online, but can’t seem to get it to work:

private void SendEmail()
    {
        // Create a System.Net.Mail.MailMessage object
        MailMessage message = new MailMessage();
    
        // Add a recipient
        message.To.Add("daveoncsharp@gmail.com");
    
        // Add a message subject
        message.Subject = "Email message from Dave on C-Sharp";
    
        // Add a message body
        message.Body = "Test email message from www.daveoncsharp.com.";
    
        // Create a System.Net.Mail.MailAddress object and
        // set the sender email address and display name.
        message.From = new MailAddress("daveoncsharp@gmail.com", "Dave on C-Sharp");
    
        // Create a System.Net.Mail.SmtpClient object
        // and set the SMTP host and port number
        SmtpClient smtp = new SmtpClient("smtp.gmail.com", 587);
    
        // If your server requires authentication add the below code
        // =========================================================
        // Enable Secure Socket Layer (SSL) for connection encryption
        smtp.EnableSsl = true;
    
        // Do not send the DefaultCredentials with requests
        smtp.UseDefaultCredentials = false;
    
        // Create a System.Net.NetworkCredential object and set
        // the username and password required by your SMTP account
        smtp.Credentials = new NetworkCredential("you@address.com", "yourpassword");
        // =========================================================
    
        // Send the message
        smtp.Send(message);
    }

The above is likely to be my solution. Can anyone figure out how to use this with unity?
Or better yet, does anyone know of a simple enough way to send emails with attached files from unity?

The surest way I know of would be to send it via WWWForm object to a script on a server you have script and mail access to, and relay it to email via that, like a proxy. But it would be cool if that script you posted worked, I’m just not sure it would always work on every network.