<?php
$bugun = date('Y-m-d');
include "../baglanti.php";
$mail = mysql_query("select * from bakiye where yenileme_tarih='$bugun' order by mus_adi");
while ($oku = mysql_fetch_array($mail))
{
$id = $oku['id'];
$mus_id = $oku['mus_id'];
$mus_adi = $oku['mus_adi'];
$mus_telefon = $oku['mus_telefon'];
$yenileme_tarih = $oku['yenileme_tarih'];
$mus_email = $oku['mus_email'];
?>
<div><?php echo $mus_adi; ?> - <?php echo $yenileme_tarih; ?> - <?php echo $mus_email; ?><a href="?i=<?php echo $id; ?>"> * mail gönder</a></div>
<?php } ?>
<div class="container">
<div class="row">
<div class="col-md-4 col-md-offset-4">
<?php
include "../baglanti.php";
$gelen = $_GET['i'];
$teknik = mysql_query("select * from bakiye where id='$gelen'");
while ($oku = mysql_fetch_array($teknik))
{
$id = $oku['id'];
$mus_id = $oku['mus_id'];
$mus_adi = $oku['mus_adi'];
$mus_telefon = $oku['mus_telefon'];
$yenileme_tarih = $oku['yenileme_tarih'];
$aciklama = $oku['aciklama'];
$borc = $oku['borc'];
$mus_email = $oku['mus_email'];
$urun_adi = $oku['urun_adi'];
$mailsend = $oku['mailsend'];
if ( $_POST ){
$mus_adi = htmlspecialchars(trim($_POST['mus_adi']));
$email = htmlspecialchars(trim($_POST['email']));
$mesaj = htmlspecialchars(trim($_POST['mesaj']));
include 'class.phpmailer.php';
$mail = new PHPMailer();
$mail->IsSMTP();
$mail->SMTPAuth = true;
$mail->Host = 'smtp.gmail.com';
$mail->Port = 587;
$mail->SMTPSecure = 'tls';
$mail->AddReplyTo('xxxx@gmail.com', 'xxx');
$mail->Username = 'xxxx@gmail.com';
$mail->Password = 'xxxxx';
$mail->SetFrom($mail->Username, 'xxxxx');
$mail->AddAddress($mus_email);
$mail->CharSet = 'UTF-8';
$mail->Subject = 'xxxx';
$content = '<div style="background: #eee; padding: 10px; font-size: 14px; width:600px; border-radius:5px;">Müşteri Adı: '.$mus_adi.'<br/><br/> '.$mesaj.'<br/><br/>
xxxxxx<br/>
xxxxx<br/>
xxxxx</div>';
$mail->MsgHTML($content);
if($mail->Send()) {
// e-posta başarılı ile gönderildi
echo '<div class="form-control" style=" border: 1px solid #fff;
color:#fff;
background-color:#f00;
border-radius:5px; margin-top:-12px;
" >E-posta müşterinize başarıyla gönderildi.<iframe width="0" height="0" src="../mailsend.php?i='.$gelen.'"></iframe></div>';
} else {
// bir sorun var, sorunu ekrana bastıralım
echo '<div class="error">'.$mail->ErrorInfo.'</div>';
}
}
?>
<form method="post" action="" >
<input type="text" name="mailsend" hidden="visible" >
<input type="text" hidden="visible" name="mus_id" value="<?php echo $mus_id; ?>"/>
<label>Müşteri Adı</label>
<input type="text" style="background-color:#cddc39;" class="form-control" value="<?php echo $mus_adi; ?>" name="mus_adi" placeholder=""/>
<br>
<label>E-Mail Adresi</label>
<input type="text" style="background-color:#cddc39;" class="form-control" value="<?php echo $mus_email; ?>" name="email" placeholder=""/>
<br>
<div class="form-group">
<label>Şablon Seçimi</label><br>
<select style="background-color:#00c0ef; color:#fff;" name="sablon" id="sablon" class="form-control">
<option value="1">Ödeme Bildirme</option>
<option value="2">Geçmiş Ödeme Bildirimi</option>
<option value="3">Diğer</option>
</select>
</div>
<div class="form-group">
<label>Gönderilecek E-Mail</label>
<textarea name="mesaj" id="msgtext" placeholder="" rows="5" class="form-control" /></textarea>
</div>
<button type="submit" name="gonder" class="btn btn-danger btn-sm"> <i class="fa fa-send"> </i> E-Mail Gönder</button> /
<button type="reset" class="btn btn-default btn-sm"><i class="fa fa-ban"></i> Formu Temizle</button> /
</form>
<?php AutoMail Gönderimi
0
●111
- 30-03-2019, 18:37:34Arkadaşlar mysql tablomda belirlediğim tarih geldiğinde otomatik mail göndersin istiyorum. Aşağıdaki kodlarla manuel gönderim sağlıyorum. Otomatik gönderim sağlayan bir sayfa oluşturup cronjobs üzerinden görev verip sayfa yenilemesini isteyeceğim.