Merhaba arkadaşlar;
PHP Wordpress Eklentisiz Temadan Wordpress Kurulurkan eklenen admin mailine eklentisiz mail gönderme forum kodunun neresinde tam olarak sorun var
Kodlama Yapan arkadaşlar bakabilir mi
<?php
$nameError = '';
$phoneError = '';
$emailError = '';
$commentError = '';
if(isset($_POST['submitted']) && wp_verify_nonce( $_POST['contactform'], 'test_contact' ) ) {
if(trim($_POST['contactName']) === '') {
$nameError = __('Lütfen adınızı girin.');
$hasError = true;
} else {
$name = trim($_POST['contactName']);
}
if(trim($_POST['contact-phone']) === '') {
$phoneError = __('Lütfen telefon no girin.');
$hasError = true;
} else {
$phone = trim($_POST['contact-phone']);
}
if(trim($_POST['contact-email']) === '') {
$emailError = __('Lütfen e-posta adresinizi girin.');
$hasError = true;
} else if ( !filter_var(trim($_POST['contact-email']), FILTER_VALIDATE_EMAIL) ) {
$emailError = __('Bu e-posta adresi geçersiz!');
$hasError = true;
} else {
$email = trim($_POST['contact-email']);
}
if(trim($_POST['contact-message']) === '') {
$commentError = __('Lütfen mesajınızı girin.');
$hasError = true;
} else {
if(function_exists('stripslashes')) {
$comments = stripslashes(trim($_POST['contact-message']));
} else {
$comments = trim($_POST['contact-message']);
}
}
if(!isset($hasError)) {
$emailTo = get_option('admin_email');
if (!isset($emailTo) || ($emailTo == '') ){
$emailTo = get_option('admin_email');
}
$mailsubject = 'test İletişim ['.$subject.']';
$body = __('Gönderen').": $name n".__('E-posta').": $email n".__('Mesaj').": $comments";
$headers = 'From: '.$name.' <'.$emailTo.'>' . "rn" . 'Reply-To: ' . $email;
wp_mail($emailTo, $mailsubject, $body, $headers);
$emailSent = true;
$redirect = add_query_arg( 'submit', 'true', get_the_permalink() );
wp_redirect($redirect);
die();
}
}
?>
<form class="custom-form contact-form row" action="<?php echo add_query_arg( 'submit', 'true', get_the_permalink() ); ?>" method="post" id="contactForm">
<div class="col-lg-6 col-6">
<label for="contactName" class="form-label">Full Name</label>
<input type="text" name="contactName" id="contactName" class="form-control" value="<?php echo($name); ?>" placeholder="Your Name" required>
</div>
<div class="col-lg-6 col-6">
<label for="contact-phone" class="form-label">Phone Number</label>
<input type="telephone" name="contact-phone" id="contact-phone" pattern="[0-9]{3}-[0-9]{3}-[0-9]{4}" class="form-control" value="<?php echo($phone); ?>" placeholder="123-456-7890">
</div>
<div class="col-12">
<label for="contact-email" class="form-label">Email</label>
<input type="email" name="contact-email" id="contact-email" pattern="[^ @]*@[^ @]*" class="form-control" value="<?php echo($email); ?>" placeholder="Your Email" required>
<label for="contact-message" class="form-label">Message</label>
<textarea class="form-control" rows="5" id="contact-message" name="contact-message" placeholder="Your Message"></textarea>
</div>
<div class="col-lg-5 col-12 ms-auto">
<button type="submit" id="submit" class="form-control" value="Send">Send</button>
</div>
<div class="buttons">
<input type="hidden" id="contactform" name="contactform" value="25ee7f6b38" />
<input type="hidden" name="_wp_http_referer" value="<?php echo add_query_arg( 'submit', 'true', get_the_permalink() ); ?>" />
<input type="hidden" name="submitted" id="submitted" value="true" />
</div>
</form>
</div>