0

I have this codes:

<!DOCTYPE html>
<html>
    <head>
        <title>Main</title>
    </head>
    <body bgcolor="Cyan">
        <center>
            <a href="mailto:youremail@example.com?subject=ErrorLog&body=">Click me to send your log errors to developer.</a>
        </center>
    </body>
</html>

The log file is located at C:\Users\aimst\AppData\Local\log.txt.

Also I want to Hide this:

enter image description here

Thanks for help <3

miile7
  • 2,547
  • 3
  • 23
  • 38
XnoobieX
  • 3
  • 2

1 Answers1

0

This is not possible with pure html. Html only offers you a shortcut to sending an email yourself as a user. This is like giving an email template for users. I think you want to send an email from your server to a knwon adress. So "the website" sends a filled email. For this you need any kind of server-side programming because the server sends the email, not a user via his mail server.

PS: Note that the html tags center and the attribute bgcolor both are deprecated. Use CSS for both. The background property replaces the bgcolor attribute. Centering elements is a little bit more tricky but one solution is using flex layout. This post shows an example and also other possibilities how to center an element. (In my opinion flex is the best solution because is supported in most of the browsers now and it is not any kind of workaround but the intendet functionality.)


Because I know php here is an example code in php. This is also possible to write in any other language like python, java, javascript, ...

Html file:

<!DOCTYPE html>
<html>
    <head>
        <link rel="stylesheet" href="style.css" />
    </head>
    <body>
        <form action="sendmail.php">
            <input type="submit" value="Send your log errors to developer." />
        </form>
    </body>
</html>

CSS file style.css

body{
    background: cyan;
}

form{
    display: flex; 
    justify-content: center;
}

PHP sendmail.php file

<?php
    $message = 
        "The following logs have been sent by a user:\n\n".
        file_get_contents("C:\Users\aimst\AppData\Local\log.txt");

    mail("yourname@example.com", "Error Logs", $message);
?>

Note that you need any php server running for this, for example Apache XAMPP.

miile7
  • 2,547
  • 3
  • 23
  • 38