Das ist mein html Abschnitt, erklären Sie mir bitte, was in Form Aktion zu übergeben:Wordpress - Senden Sie E-Mail mit Anhang
<form action="" method="post" enctype="multipart/form-data">
<div class="inputtext"><input type="text" placeholder="Fast Name*" name="fname"></div>
<div class="inputtext"><input type="text" placeholder="Email ID*" name="email"></div>
<div class="inputtext">
<select name="bcontact">
<option value="">-- Best Way to Contact --</option>
<option value="Phone">Phone</option>
<option value="Email">Email</option>
</select></div>
<div class="inputtext"><input type="text" placeholder="Years Of Experience" name="experience"></div>
<div class="inputtext"><input type="file" name="uploaded_file"></div>
<div class="input100per"><textarea placeholder="How can we help you?" rows="5" name="message"></textarea></div>
<div class="input100per"><input type="submit" value="Submit" name="submit">
<div>
</form>
Code: Ich brauche eine E-Mail mit Anhang wie PDF/Word-Dokument zu senden.
if (isset($_POST['submit'])) {
global $wpdb;
$to ='[email protected]';
$from = '[email protected]';
$name = get_bloginfo('name');
$attachment = $_POST['file'];
$headers = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: multipart/mixed; charset=iso-8859-1' . "\r\n";
$headers .= 'From: ' . $name . ' <' . $from . '>' . "\r\n";
$subject = 'Testing';
$msg = 'Yay!';
$mail_attachment = array($attachment);
wp_mail($to, $subject, $msg, $headers, $mail_attachment);
echo 'Email sent';
} else {
echo 'Email not sent';
}
Bitte finden Sie mir die Lösung. Vielen Dank!
Groß Sie es gelöst! Könnten Sie Ihre eigene Antwort als Lösung markieren, um Ihre Frage zu beantworten? Vielen Dank! – SaschaM78