Register Register Member Login Member Login Member Login Forgot Password ??
PHP , ASP , ASP.NET, VB.NET, C#, Java , jQuery , Android , iOS , Windows Phone
 

Registered : 109,027

HOME > Web Host > Windows Server 2008 (Web Server) > ติดตั้ง SMTP ส่งอีเมล์ ด้วย PHP / ASP.Net บน Windows Server 2008



Clound SSD Virtual Server

ติดตั้ง SMTP ส่งอีเมล์ ด้วย PHP / ASP.Net บน Windows Server 2008

ติดตั้ง SMTP ส่งอีเมล์ ด้วย PHP / ASP.Net บน Windows Server 2008 ในกรณีที่ Application ของเรา ที่พัฒนาด้วยภาษาต่าง ๆ มีการส่งอีเมล์ออกจาก Windows Server 2008 ด้วย Script ของ ASP / ASP.Net หรือ PHP และก่อนที่จะใช้งานและส่งอีเมล์ออกได้ จะต้องทำการติดตั้ง SMTP และเปิดใช้งาน SMTP บน Windows Server 2008 ให้เรียบร้อยเสียก่อน และการติดตั้ง SMTP ก็สามารถทำได้ง่าย ๆ เพียงแค่เปิด Service ของ SMTP และปรับแต่งค่านิด ๆ หน่อย ๆ ก็สามารถส่งอีเมล์ออกจากเครื่องไปยัง Email ปลายทางได้ทันที

การติดตั้ง SMTP บน Windows Server 2008

Windows Server 2008 SMTP Mail PHP ASP.Net

เปิด Server Manager คลิกขวาที่ Features -> Add Features

Windows Server 2008 SMTP Mail PHP ASP.Net

เลือก SMTP Server

Windows Server 2008 SMTP Mail PHP ASP.Net

ทำการ Install








Windows Server 2008 SMTP Mail PHP ASP.Net

ติดตั้งเรียบร้อย เลือก Close

Windows Server 2008 SMTP Mail PHP ASP.Net

หลังจากที่ติดตั้ง SMTP เรียบร้อย จะมี IIS Manager ของ Version 6 ซึ่งเอาไว้จัดการกับ SMTP Server

Windows Server 2008 SMTP Mail PHP ASP.Net

หน้าจอ IIS 6 ซึ่งจะมี SMTP Server อยู่

Windows Server 2008 SMTP Mail PHP ASP.Net

คลิกขวาที่ SMTP -> Properties

Windows Server 2008 SMTP Mail PHP ASP.Net

ภายใต้ Tab ของ Access คลิก Connection

Windows Server 2008 SMTP Mail PHP ASP.Net

เลือก All except the list below

Windows Server 2008 SMTP Mail PHP ASP.Net

และ Reply

Windows Server 2008 SMTP Mail PHP ASP.Net

เลือก All except the list below

Windows Server 2008 SMTP Mail PHP ASP.Net

จากนั้นให้กลับมาที่ IIS6 หน้าจอสำหรับจัดการกับ SMTP ให้ทำการ Stop และ Start ใหม่ซะ 1 ครั้ง








เพิ่มเติม
ขั้นตอนนี้ถ้าการทำงานช้า หรือไม่สามารถ Stop / Start ได้ ให้ทำการ Restart เครื่อง Server ซะ 1 รอบ จากนั้นค่อยมาดู Service ว่าทำงานปกติหรือไม่

TestMail.php (PHP)
<html>
<head>
<title>ThaiCreate.Com PHP Sending Email</title>
</head>
<body>
<?
	$strTo = "[email protected]";
	$strSubject = "Test sending mail";
	$strHeader = "From: [email protected]";
	$strMessage = "My Body & My Description";
	$flgSend = mail($strTo,$strSubject,$strMessage,$strHeader); 
	if($flgSend)
	{
		echo "Email sending.";
	}
	else
	{
		echo "Email cannot send.";
	}
?>
</body>
</html>

ตัวอย่างการส่งอีเมล์ออกด้วย PHP Script


TestMail.aspx (ASP.Net)
<%@ Import Namespace="System.Web.Mail"%>
<%@ Page Language="VB" %>
<script runat="server">
    Sub Page_Load(sender As Object, e As EventArgs)				
        Dim myMail As New MailMessage()

		myMail.To = "[email protected]"
		myMail.From = "[email protected]"
		myMail.Subject = "Test sending mail"

		myMail.BodyFormat = MailFormat.Text
		myMail.Body = "My Body & Description"
		
		SmtpMail.Send(myMail)
		myMail = Nothing

		Me.lblText.Text = "Mail Sending."
	End Sub

</script>
<html>
<head>
    <title>ThaiCreate.Com ASP.NET - Send Mail</title>
</head>
<body>
	<form id="form1" runat="server">
		<asp:Label id="lblText" runat="server"></asp:Label>
	</form>
</body>
</html>

ตัวอย่าง Script ส่งอีเมล์ด้วย ASP.Net


Windows Server 2008 SMTP Mail PHP ASP.Net

ถ้า SMTP สามารถส่งออกได้ อีเมล์ก็จะไปถึงปลายทางดังรูป

เพิ่มเติม
ในกรณีที่ไม่สามารถส่งอีเมล์ออกไปปลายทางได้ ลองตรวจสอบดูว่าในโฟเดอร์ C:\inetpub\mailroot\Queue ว่ามีอีเมล์ค้างอยู่หรือไม่ ถ้ามี และไม่ออกไปข้างนอก อาจจะต้องตรวจสอบ Firewall ของ Network ว่ายอมให้มีการส่งอีเมล์ออกไปหรือไม่



บทความถัดไปที่แนะนำให้อ่าน


   
Share


ช่วยกันสนับสนุนรักษาเว็บไซต์ความรู้แห่งนี้ไว้ด้วยการสนับสนุน Source Code 2.0 ของทีมงานไทยครีเอท


ลองใช้ค้นหาข้อมูล


   


Bookmark.   
       
  By : ThaiCreate.Com Team (บทความเป็นลิขสิทธิ์ของเว็บไทยครีเอทห้ามนำเผยแพร่ ณ เว็บไซต์อื่น ๆ)
  Score Rating :  
  Create/Update Date : 2013-07-06 07:48:31 / 2017-03-19 12:51:04
  Download : No files
 Sponsored Links / Related

 
ติดตั้ง Windows Server 2008 ให้บริการ Web Server และ Domain / Web Site
Rating :

 
สร้าง DNS Server สำหรับ Domain บน Windows Server 2008
Rating :

 
ติดตั้ง IIS Web Server เพื่อให้บริการ Web Server (Windows Server 2008)
Rating :

 
ติดตั้ง เปิดใช้งาน ASP / ASP.Net / CGI บน IIS (Windows Server 2008)
Rating :

 
สร้าง Web Site และ Domain บน IIS และ Path ของเว็บ - Windows Server 2008
Rating :

 
ติดตั้ง FTP สร้าง FTP Account การ Upload ไฟล์ บน Windows Server 2008
Rating :

 
ติดตั้ง PHP เพื่อใช้งาน PHP บน IIS Web Server (Windows Server 2008)
Rating :

 
ติดตั้ง MySQL Database เพื่อใช้งาน MySQL บน Windows Server 2008
Rating :

 
การชี้ Domain DNS โดเมนของเรา มายัง Windows Server 2008
Rating :


ThaiCreate.Com Forum


Comunity Forum Free Web Script
Jobs Freelance Free Uploads
Free Web Hosting Free Tools

สอน PHP ผ่าน Youtube ฟรี
สอน Android การเขียนโปรแกรม Android
สอน Windows Phone การเขียนโปรแกรม Windows Phone 7 และ 8
สอน iOS การเขียนโปรแกรม iPhone, iPad
สอน Java การเขียนโปรแกรม ภาษา Java
สอน Java GUI การเขียนโปรแกรม ภาษา Java GUI
สอน JSP การเขียนโปรแกรม ภาษา Java
สอน jQuery การเขียนโปรแกรม ภาษา jQuery
สอน .Net การเขียนโปรแกรม ภาษา .Net
Free Tutorial
สอน Google Maps Api
สอน Windows Service
สอน Entity Framework
สอน Android
สอน Java เขียน Java
Java GUI Swing
สอน JSP (Web App)
iOS (iPhone,iPad)
Windows Phone
Windows Azure
Windows Store
Laravel Framework
Yii PHP Framework
สอน jQuery
สอน jQuery กับ Ajax
สอน PHP OOP (Vdo)
Ajax Tutorials
SQL Tutorials
สอน SQL (Part 2)
JavaScript Tutorial
Javascript Tips
VBScript Tutorial
VBScript Validation
Microsoft Access
MySQL Tutorials
-- Stored Procedure
MariaDB Database
SQL Server Tutorial
SQL Server 2005
SQL Server 2008
SQL Server 2012
-- Stored Procedure
Oracle Database
-- Stored Procedure
SVN (Subversion)
แนวทางการทำ SEO
ปรับแต่งเว็บให้โหลดเร็ว


Hit Link
   







Load balance : Server 01
ThaiCreate.Com Logo
© www.ThaiCreate.Com. 2003-2024 All Rights Reserved.
ไทยครีเอทบริการ จัดทำดูแลแก้ไข Web Application ทุกรูปแบบ (PHP, .Net Application, VB.Net, C#)
[Conditions Privacy Statement] ติดต่อโฆษณา 081-987-6107 อัตราราคา คลิกที่นี่