|
 |
|
ปรึกษาเรื่องการเขียนระบบ DB เพื่อเก็บข้อมูลสมาชิกแล้วสามารถ ส่งเมลให้สมาชิกตามเงื่อนไขครับ |
|
 |
|
|
 |
 |
|
ไปเจอบทความนี้มาน่าสนใจครับ ลองดูนะครับ ยังไม่ว่างทดสอบเลยไม่รู้ว่าใช้ได้จริงไหม
เจ้าตัวนี้คือ "ส่งอีเมล์อัตโนมัติด้วย Cronjob" *ต้องเป็นเจ้าของเว็บไซต์สามารถทำตามได้ถูกต้องนะครับ
1.สร้างไฟล์ automatic_sendmail.php
Code (PHP)
#!/usr/local/bin/php -q
<?php
$to = "Example < [email protected] >" ;
$subject = "Send E-Mail automatic by CronJob" ;
$headers = "MIME-Type: 1.0 rn";
$headers.= "Content-Type: text/html; charset=tis-620 rn";
$headers.= "From: Admin <admin@//domain mail ของคุณ> rn";
$body = "นี่เป็นอีเมล์ตอบกลับอัตโนมัติ n" ;
mail( $to, $subject, $body, $headers) ;
}
?>
2.อัปโหลดไปเก็บไว้บนเซิฟเวอร์ และสิ่งที่ห้ามลืมโดยเด็ดขาด ก็คือ คุณต้องเซตให้ไฟล์นี้ สามารถ execute ได้ ( mode 0777 )
3.เข้าไป Cpanel / DirectAdmin หาคำว่า "Cronjobs" ให้เจอ

4.ตั้งเวลาให้ CronJob excute ไฟล์ php ตามวันเวลาที่ต้องการ

จะให้ Run วันไหน เดือนไหน ทุกๆ กี่นาที หรือ ทุกๆ ชั่วโมง ก็ตั้งเอาครับ
/usr/bin/php พาธของไฟล์ที่จะ execute
ถ้าต้องการอยากทราบ Path ที่อยู่ สามารถดูได้จาก
phpinfo หาคำว่า " _SERVER["DOCUMENT_ROOT"] "
หลังจากนั้น คลิกปุ่ม Add ก็เป็นอันเสร็จสิ้นกระบวนการ Cronjob
จะรันไฟล์ automatic_sendmail.php ตามวันเวลาที่ตั้งไว้
อ้างอิงจากบทความ : ส่งอีเมล์อัตโนมัติด้วยCronjob
URL : http://www.select2web.com/other/automate-email-with-cronjob.html
|
 |
 |
 |
 |
Date :
2013-06-26 10:07:56 |
By :
biggest59 |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ขอบคุณครับ
|
 |
 |
 |
 |
Date :
2013-06-26 12:57:16 |
By :
naotonarak |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
|
|
|

|
Load balance : Server 00
|