ThaiSEOBoard.com

พัฒนาเว็บไซต์ => Programming => ข้อความที่เริ่มโดย: icenobu ที่ 18 พฤศจิกายน 2013, 14:59:06



หัวข้อ: สอบถามเรื่องส่งเมล์
เริ่มหัวข้อโดย: icenobu ที่ 18 พฤศจิกายน 2013, 14:59:06
อยากจะทำเช็คสถานะ server ว่า online หรือ offline  เมื่อเกิดเหตุการณ์ server ล่ม สถานะจะขึ้นว่า offline
แล้วให้มันส่งเมล์แจ้งอัตโนมัติ จะทำยังไงค่ะ

โค๊ด:
//Do this if it is closed
echo( "<font color='red'>Offline</font>");
}
if( $sock ){
//Do this if it is open
echo( "<font color='green'>Online</font>" );
fclose($sock);
}

 :wanwan031: :wanwan031: :wanwan031:


หัวข้อ: Re: สอบถามเรื่องส่งเมล์
เริ่มหัวข้อโดย: smapan ที่ 18 พฤศจิกายน 2013, 15:07:00
check server status
http://stackoverflow.com/questions/18588673/drupal-checking-online-offline-status-of-external-server

send mail
http://stackoverflow.com/questions/4963688/how-to-send-email-from-php-without-smtp-server-installed


หัวข้อ: Re: สอบถามเรื่องส่งเมล์
เริ่มหัวข้อโดย: icenobu ที่ 18 พฤศจิกายน 2013, 15:57:33
ลองใส่ตามนี้ไม่ได้ค่ะ

Warning: mail() [function.mail]: "sendmail_from" not set in php.ini or custom "From:" header missing in

โค๊ด:
if( !$sock ){

//Do this if it is closed
echo( "<font color='red'>Offline</font>");

}  else {
mail( "[email protected]", "Test Email","Comment: $ip_cam" );
}


หัวข้อ: Re: สอบถามเรื่องส่งเมล์
เริ่มหัวข้อโดย: smapan ที่ 18 พฤศจิกายน 2013, 16:04:49
ลองใส่ตามนี้ไม่ได้ค่ะ

Warning: mail() [function.mail]: "sendmail_from" not set in php.ini or custom "From:" header missing in

โค๊ด:
if( !$sock ){

//Do this if it is closed
echo( "<font color='red'>Offline</font>");

}  else {
mail( "[email protected]", "Test Email","Comment: $ip_cam" );
}

คือ คุณต้อง เปิดใช้งานฟังก์ชั่น ส่งเมล์

และ ต้องติดตั้ง Mail Server ด้วยครับ

 :P


หัวข้อ: Re: สอบถามเรื่องส่งเมล์
เริ่มหัวข้อโดย: MeenyFancy ที่ 18 พฤศจิกายน 2013, 16:32:23
http://www.thaicreate.com/asp/iis-smtp-virtual-server.html


หัวข้อ: Re: สอบถามเรื่องส่งเมล์
เริ่มหัวข้อโดย: icenobu ที่ 19 พฤศจิกายน 2013, 10:19:31
ลองใส่ตามนี้ไม่ได้ค่ะ

Warning: mail() [function.mail]: "sendmail_from" not set in php.ini or custom "From:" header missing in

โค๊ด:
if( !$sock ){

//Do this if it is closed
echo( "<font color='red'>Offline</font>");

}  else {
mail( "[email protected]", "Test Email","Comment: $ip_cam" );
}


คือ คุณต้อง เปิดใช้งานฟังก์ชั่น ส่งเมล์

และ ต้องติดตั้ง Mail Server ด้วยครับ

 :P


ยังไม่เข้าใจ "เปิดใช้งานฟังก์ชั่น ส่งเมล์"

ไม่แน่ใจว่าลิ้งค์นี้หรือเปล่าค่ะ
http://www.select2web.com/appserv/ssl-appserv.html


หัวข้อ: Re: สอบถามเรื่องส่งเมล์
เริ่มหัวข้อโดย: smapan ที่ 19 พฤศจิกายน 2013, 10:22:04
ลองใส่ตามนี้ไม่ได้ค่ะ

Warning: mail() [function.mail]: "sendmail_from" not set in php.ini or custom "From:" header missing in

โค๊ด:
if( !$sock ){

//Do this if it is closed
echo( "<font color='red'>Offline</font>");

}  else {
mail( "[email protected]", "Test Email","Comment: $ip_cam" );
}


คือ คุณต้อง เปิดใช้งานฟังก์ชั่น ส่งเมล์

และ ต้องติดตั้ง Mail Server ด้วยครับ

 :P


ยังไม่เข้าใจ "เปิดใช้งานฟังก์ชั่น ส่งเมล์"

ไม่แน่ใจว่าลิ้งค์นี้หรือเปล่าค่ะ
[url]http://www.select2web.com/appserv/ssl-appserv.html[/url]


ตอนนี้ใช้ mail server อะไรอยู่ครับ


หัวข้อ: Re: สอบถามเรื่องส่งเมล์
เริ่มหัวข้อโดย: icenobu ที่ 19 พฤศจิกายน 2013, 11:27:57
domain ที่ใช้ทำผูกกับ hotmail ไว้อ่ะค่ะ แบบนี้ได้ไหมค่ะ  :-X


หัวข้อ: Re: สอบถามเรื่องส่งเมล์
เริ่มหัวข้อโดย: smapan ที่ 19 พฤศจิกายน 2013, 11:58:42
domain ที่ใช้ทำผูกกับ hotmail ไว้อ่ะค่ะ แบบนี้ได้ไหมค่ะ  :-X


ทำได้ครับ
ใช้ SMTP ของ hotmail ได้เลยครับ
ดูตัวอย่าลิ้งนี้ครับ (ในตัวอย่างใช้ของ กูเกิลให้เปลี่ยนให้ตรงกับที่ใช้ปัจจุบันครับ)

http://stackoverflow.com/questions/4963688/how-to-send-email-from-php-without-smtp-server-installed

โดยใน ตัวอย่างจะใช้ PHPMailer
สามารถดาวน์โหลดได้ที่ https://github.com/Synchro/PHPMailer/archive/master.zip
หลังจากที่ดาวน์โหลดไฟล์มาแล้วให้แตกไฟล์ออกมา จะมีไฟล์ของ PHPMailer
ให้เรา include ไฟล์ class.phpmailer.php ไปใน script ที่เราต้องการส่งอีเมล์


หัวข้อ: Re: สอบถามเรื่องส่งเมล์
เริ่มหัวข้อโดย: icenobu ที่ 19 พฤศจิกายน 2013, 13:52:35
domain ที่ใช้ทำผูกกับ hotmail ไว้อ่ะค่ะ แบบนี้ได้ไหมค่ะ  :-X


ทำได้ครับ
ใช้ SMTP ของ hotmail ได้เลยครับ
ดูตัวอย่าลิ้งนี้ครับ (ในตัวอย่างใช้ของ Googleให้เปลี่ยนให้ตรงกับที่ใช้ปัจจุบันครับ)

[url]http://stackoverflow.com/questions/4963688/how-to-send-email-from-php-without-smtp-server-installed[/url]

โดยใน ตัวอย่างจะใช้ PHPMailer
สามารถดาวน์โหลดได้ที่ [url]https://github.com/Synchro/PHPMailer/archive/master.zip[/url]
หลังจากที่ดาวน์โหลดไฟล์มาแล้วให้แตกไฟล์ออกมา จะมีไฟล์ของ PHPMailer
ให้เรา include ไฟล์ class.phpmailer.php ไปใน script ที่เราต้องการส่งอีเมล์


ขอบคุณมากค่ะ พอเข้าใจแล้ว
 :wanwan017: :wanwan017: :wanwan017: