Modifizierte E-Mails mit Python versenden
Verfasst: Freitag 17. Mai 2019, 14:20
Hallo liebe Community,
auch wenn es schon viele Beiträge zu diesem Thema im Internet gibt, habe ich diesen Beitrag erstellt, um Hilfe bei einem spezifischeren Problem zu bekommen.
Hier das Problem: Ich muss von der (unten in html-Code angegebenen) Website aus die Daten, die die User in die dort vorhandenen Zeilen eintragen, an die auch dort eingetragene E-Mail-Adresse sowie auch an meine E-Mail aus senden lassen. Das heißt dass die User und ich, als Administrator, eine Art "Anmeldebestätigung" per Mail zugesendet bekommen (in der etwas steht wie "Danke für deine Anmeldung. Hier nochmal deine Daten im Überblick: Name: xy Phone: 1234 Chosen Event: blablabla") sobald sie ihre Daten in die html-Textfelder eingetragen haben.
Hier der Code:
SIGNUP =
"""<html>
<head>
<br>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<style>
body {margin: 0;}
ul.topnav {
list-style-type: none;
margin: 0;
padding: 0;
overflow: hidden;
background-color: #333;
}
ul.topnav li {float: left;}
ul.topnav li a {
display: block;
color: white;
text-align: center;
padding: 14px 16px;
text-decoration: none;
}
ul.topnav li a:hover:not(.active) {background-color: "black";}
ul.topnav li a.active {background-color: "black";}
ul.topnav li.right {float: right;}
@media screen and (max-width: 600px) {
ul.topnav li.right,
ul.topnav li {float: none;}
}
</style>
<ul class="topnav">
<li><a class="active" href="nicht wichtig">egal</a></li>
<li><a href="nicht wichtig">egal</a></li>
<li><a href="nicht wichtig">egal</a></li>
<li><a href="nicht wichtig">egal</a></li>
</ul>
<div style="padding:0 16px;">
</div>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta http-equiv="x-ua-compatible" content="ie=edge">
<title>My Example</title>
<!-- CSS -->
<style>
.myForm {
font-family: "Lucida Sans Unicode", "Lucida Grande", sans-serif;
font-size: 0.8em;
width: 30em;
padding: 1em;
border: 1px solid #ccc;
}
.myForm * {
box-sizing: border-box;
}
.myForm fieldset {
border: none;
padding: 0;
}
.myForm legend,
.myForm label {
padding: 0;
font-weight: bold;
}
.myForm label.choice {
font-size: 0.9em;
font-weight: normal;
}
.myForm label {
text-align: left;
display: block;
}
.myForm input[type="text"],
.myForm input[type="tel"],
.myForm input[type="email"],
.myForm input[type="datetime-local"],
.myForm select,
.myForm textarea {
float: right;
width: 60%;
border: 1px solid #ccc;
font-family: "Lucida Sans Unicode", "Lucida Grande", sans-serif;
font-size: 0.9em;
padding: 0.3em;
}
.myForm textarea {
height: 100px;
}
.myForm input[type="radio"],
.myForm input[type="checkbox"] {
margin-left: 40%;
}
.myForm button {
padding: 1em;
border-radius: 0.5em;
background: #eee;
border: none;
font-weight: bold;
margin-left: 40%;
margin-top: 1.8em;
}
.myForm button:hover {
background: #ccc;
cursor: pointer;
}
</style>
</head>
<body>
<form class="myForm" method="post" enctype="application/x-www-form-urlencoded" action="/html/codes/html_form_handler.cfm">
<p>
<label>Name
<input type="text" name="customer_name" required>
</label>
</p>
<p>
<label>Phone
<input type="tel" name="phone_number">
</label>
</p>
<p>
<label>Email
<input type="email" name="email_address">
</label>
</p>
<p>
<label>Chosen events
<input type="events" name="event_names">
</label>
</p>
<!--
<fieldset>
<legend>Which event do you want to sign up for?</legend>
<p><label class="choice"> <input type="radio" name="taxi" required value="FAIRstrickt"> FAIRstrickt </label></p>
<p><label class="choice"> <input type="radio" name="taxi" required value="Soirée Cabaret"> Soirée Cabaret </label></p>
<p><label class="choice"> <input type="radio" name="taxi" required value="Move your idea"> Campusfest </label></p>
</fieldset>
-->
<style>
.button {
position: left;
background-color:#111;
border: none;
color: black;
padding: 15px 25px;
text-align:"left";
font-size: 15px;
cursor: pointer;
}
.button:hover {
background-color: '111';
}
</style>
<button class="button">Sign up</button>
</form>
</body>
</html>"""
Ich habe schon mehrmals versucht den Code selber zu schreiben, nur will er einfach nie funktionieren, deshalb wende ich mich jetzt an euch.
Bei fragen stehe ich euch natürlich gerne zur Verfügung. Sofern aber schon einmal vielen Dank für's Ansehen!
MfG XooHooX
auch wenn es schon viele Beiträge zu diesem Thema im Internet gibt, habe ich diesen Beitrag erstellt, um Hilfe bei einem spezifischeren Problem zu bekommen.
Hier das Problem: Ich muss von der (unten in html-Code angegebenen) Website aus die Daten, die die User in die dort vorhandenen Zeilen eintragen, an die auch dort eingetragene E-Mail-Adresse sowie auch an meine E-Mail aus senden lassen. Das heißt dass die User und ich, als Administrator, eine Art "Anmeldebestätigung" per Mail zugesendet bekommen (in der etwas steht wie "Danke für deine Anmeldung. Hier nochmal deine Daten im Überblick: Name: xy Phone: 1234 Chosen Event: blablabla") sobald sie ihre Daten in die html-Textfelder eingetragen haben.
Hier der Code:
SIGNUP =
"""<html>
<head>
<br>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<style>
body {margin: 0;}
ul.topnav {
list-style-type: none;
margin: 0;
padding: 0;
overflow: hidden;
background-color: #333;
}
ul.topnav li {float: left;}
ul.topnav li a {
display: block;
color: white;
text-align: center;
padding: 14px 16px;
text-decoration: none;
}
ul.topnav li a:hover:not(.active) {background-color: "black";}
ul.topnav li a.active {background-color: "black";}
ul.topnav li.right {float: right;}
@media screen and (max-width: 600px) {
ul.topnav li.right,
ul.topnav li {float: none;}
}
</style>
<ul class="topnav">
<li><a class="active" href="nicht wichtig">egal</a></li>
<li><a href="nicht wichtig">egal</a></li>
<li><a href="nicht wichtig">egal</a></li>
<li><a href="nicht wichtig">egal</a></li>
</ul>
<div style="padding:0 16px;">
</div>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta http-equiv="x-ua-compatible" content="ie=edge">
<title>My Example</title>
<!-- CSS -->
<style>
.myForm {
font-family: "Lucida Sans Unicode", "Lucida Grande", sans-serif;
font-size: 0.8em;
width: 30em;
padding: 1em;
border: 1px solid #ccc;
}
.myForm * {
box-sizing: border-box;
}
.myForm fieldset {
border: none;
padding: 0;
}
.myForm legend,
.myForm label {
padding: 0;
font-weight: bold;
}
.myForm label.choice {
font-size: 0.9em;
font-weight: normal;
}
.myForm label {
text-align: left;
display: block;
}
.myForm input[type="text"],
.myForm input[type="tel"],
.myForm input[type="email"],
.myForm input[type="datetime-local"],
.myForm select,
.myForm textarea {
float: right;
width: 60%;
border: 1px solid #ccc;
font-family: "Lucida Sans Unicode", "Lucida Grande", sans-serif;
font-size: 0.9em;
padding: 0.3em;
}
.myForm textarea {
height: 100px;
}
.myForm input[type="radio"],
.myForm input[type="checkbox"] {
margin-left: 40%;
}
.myForm button {
padding: 1em;
border-radius: 0.5em;
background: #eee;
border: none;
font-weight: bold;
margin-left: 40%;
margin-top: 1.8em;
}
.myForm button:hover {
background: #ccc;
cursor: pointer;
}
</style>
</head>
<body>
<form class="myForm" method="post" enctype="application/x-www-form-urlencoded" action="/html/codes/html_form_handler.cfm">
<p>
<label>Name
<input type="text" name="customer_name" required>
</label>
</p>
<p>
<label>Phone
<input type="tel" name="phone_number">
</label>
</p>
<p>
<label>Email
<input type="email" name="email_address">
</label>
</p>
<p>
<label>Chosen events
<input type="events" name="event_names">
</label>
</p>
<!--
<fieldset>
<legend>Which event do you want to sign up for?</legend>
<p><label class="choice"> <input type="radio" name="taxi" required value="FAIRstrickt"> FAIRstrickt </label></p>
<p><label class="choice"> <input type="radio" name="taxi" required value="Soirée Cabaret"> Soirée Cabaret </label></p>
<p><label class="choice"> <input type="radio" name="taxi" required value="Move your idea"> Campusfest </label></p>
</fieldset>
-->
<style>
.button {
position: left;
background-color:#111;
border: none;
color: black;
padding: 15px 25px;
text-align:"left";
font-size: 15px;
cursor: pointer;
}
.button:hover {
background-color: '111';
}
</style>
<button class="button">Sign up</button>
</form>
</body>
</html>"""
Ich habe schon mehrmals versucht den Code selber zu schreiben, nur will er einfach nie funktionieren, deshalb wende ich mich jetzt an euch.
Bei fragen stehe ich euch natürlich gerne zur Verfügung. Sofern aber schon einmal vielen Dank für's Ansehen!
MfG XooHooX