Send JavaScript by email

0

I have a C # code that sends emails with HTML, so far, okay, the problem is that I can not send scripts (JS). Yes, I understand why, it must be security reasons. But do not have burlar or do otherwise? "No malicious intent." My code:

using (MailMessage mail = new MailMessage())
        {
            mail.From = new MailAddress("[email protected]");
            mail.To.Add("[email protected]");
            mail.Subject = "xxx";
            mail.Body = @"<script>SCRIPT aqui.</script>";
            mail.IsBodyHtml = true;

            using (SmtpClient smtp = new SmtpClient("smtp.gmail.com", 587))
            {
                smtp.Credentials = new NetworkCredential("[email protected]", "xxx");
                smtp.EnableSsl = true;
                smtp.Send(mail);
            }
        }
    
asked by anonymous 18.02.2018 / 17:45

1 answer

1

You can always send script blocks together HTML from your email, the problem is that it will not run. The vast majority of email clients will remove or disable script execution for security reasons, regardless of whether your code is malicious or not.

In the early 2000s, this was still possible. Including some clients like Outlook and Exchange also VBScript executable and this was much riskier in the windows environment.

However, depending on what you expect and you think you need JavaScript to reach, it can be done in other ways. Such as reading confirmation, which can be done by including a parameter in the loading url of an image and monitor this in the server log (provided the user enables and accepts displaying the images).

    
19.02.2018 / 02:27