Çözüldü Envato hazır sitede email gönderme çalışmıyor

Bu konu çözüldü olarak işaretlenmiştir. Çözülmediğini düşünüyorsanız konuyu rapor edebilirsiniz.
Katılım
1 Haziran 2019
Mesajlar
1.273
Çözümler
7
Daha fazla  
Cinsiyet
Erkek
Envato'dan hazır web site aldım fakat iletişim formunu çalıştıramadım. Yardımıcı olabilir misiniz?

[CODE lang="php" title="contact.php"]<?php
/*
* CONFIGURE EVERYTHING HERE
*/

// an email address that will be in the From field of the email.
$from = 'Demo contact form <YOUR_EMAİL@DOMAİN.COM>';

// an email address that will receive the email with the output of the form
$sendTo = 'Demo contact form <YOUR_EMAİL@DOMAİN.COM>';

// subject of the email
$subject = 'New message from contact form';

// form field names and their translations.
// array variable name => Text to appear in the email
$fields = array('InputName' => 'Name', 'email' => 'InputEmail', 'InputMessage' => 'Message');

// message that will be displayed when everything is OK
$okMessage = 'Your message successfully submitted. Thank you, I will get back to you soon!';

// If something goes wrong, we will display this message.
$errorMessage = 'There was an error while submitting the form. Please try again later';

/*
* LET'S DO THE SENDING
*/

// if you are not debugging and don't need error reporting, turn this off by error_reporting(0);
error_reporting(E_ALL & ~E_NOTICE);

try
{

if(count($_POST) == 0) throw new \Exception('Form is empty');

$emailText = "You have a new message from your contact form\n=============================\n";

foreach ($_POST as $key => $value) {
// If the field exists in the $fields array, include it in the email
if (isset($fields[$key])) {
$emailText .= "$fields[$key]: $value\n";
}
}

// All the neccessary headers for the email.
$headers = array('Content-Type: text/plain; charset="UTF-8";',
'From: ' . $from,
'Reply-To: ' . $from,
'Return-Path: ' . $from,
);

// Send email
mail($sendTo, $subject, $emailText, implode("\n", $headers));

$responseArray = array('type' => 'success', 'message' => $okMessage);
}
catch (\Exception $e)
{
$responseArray = array('type' => 'danger', 'message' => $errorMessage);
}


// if requested by AJAX request return JSON response
if (!empty($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest') {
$encoded = json_encode($responseArray);

header('Content-Type: application/json');

echo $encoded;
}
// else just display the message
else {
echo $responseArray['message'];
}
[/CODE]

[CODE lang="html" title="index.html"] <!-- Contact Form -->
<form id="contact-form" class="contact-form mt-6" method="post" action="form/contact.php">

<div class="messages"></div>

<div class="row">
<div class="column col-md-4">
<!-- Name input -->
<div class="form-group">
<input type="text" class="form-control" name="InputName" id="InputName" placeholder="İsim" required="required" data-error="İsim gerekli.">
<div class="help-block with-errors"></div>
</div>
</div>

<div class="column col-md-4">
<!-- Email input -->
<div class="form-group">
<input type="email" class="form-control" id="InputEmail" name="InputEmail" placeholder="Email" required="required" data-error="Email gerekli.">
<div class="help-block with-errors"></div>
</div>
</div>

<div class="column col-md-4">
<!-- Email input -->
<div class="form-group">
<input type="text" class="form-control" id="InputSubject" name="InputSubject" placeholder="Konu" required="required" data-error="Konu gerekli.">
<div class="help-block with-errors"></div>
</div>
</div>

<div class="column col-md-12">
<!-- Message textarea -->
<div class="form-group">
<textarea name="InputMessage" id="InputMessage" class="form-control" rows="5" placeholder="Mesaj" required="required" data-error="Mesaj gerekli."></textarea>
<div class="help-block with-errors"></div>
</div>
</div>
</div>

<button type="submit" name="submit" id="submit" value="Submit" class="btn btn-default btn-full btn-animation">Gönder</button><!-- Send Button -->

</form>
<!-- Contact Form end -->
[/CODE]
 
Son düzenleyen: Moderatör:
Çözüm
Config dosyası üzerinde from değişkenini formdan aldığınız e-mail yapmalısınız.
$from = $_POST['InputEmail']
$sendTo = 'Postaların geleceği e-posta adresiniz. / info@siteniz.com'
$subject = $_POST['InputSubject']
Config dosyası üzerinde from değişkenini formdan aldığınız e-mail yapmalısınız.
$from = $_POST['InputEmail']
$sendTo = 'Postaların geleceği e-posta adresiniz. / info@siteniz.com'
$subject = $_POST['InputSubject']
 
Çözüm
Hocam çalışmadı veya ben yapamadım.
 
Son düzenleme:
Çoğu hostingde mail fonksiyonu kapalıdır. Dediklermizi yapmanıza rağmen mail atamıyorsanız sebebi hostinginizin mail fonksiyonunu devre dışı bırakmış olmasıdır.
 
Bu siteyi kullanmak için çerezler gereklidir. Siteyi kullanmaya devam etmek için çerezleri kabul etmelisiniz. Daha Fazlasını Öğren.…