


| Gửi mail với CDOSYS trong ASP |
|
CDO (Collaboration Data Objects) là kỹ thuật của Microsoft nhằm tạo những ứng dụng có thế gửi các message qua mạng. CDOSYS là một Component trong ASP. Chúng ta sẽ sử dụng Component này để gửi mail. Cũng tương tự như các phần trước, chúng ta sẽ chia ra làm 2 trang EmailForm.html: Là một HTML form để nhập các thông tin như địa chỉ mail, nội dung... EmailProcess.asp: Sẽ lấy thông tin từ EmailForm và sử dụng Trang EmailForm.html <form method="POST" action="EmailProcess.asp"> To <input type="text" name="To"/> From <input type="text" name="From"/> Subject <input type="text" name="Subject"/> Body <textarea name="Body" rows="5" cols="20" wrap="physical" > </textarea> <input type="submit" /> </form> Trang EmailProcess.asp <% 'Sends an email Dim mail Set mail = Server.CreateObject("CDO.Message") mail.To = Request.Form("To") mail.From = Request.Form("From") mail.Subject = Request.Form("Subject") mail.TextBody = Request.Form("Body") mail.Send() Response.Write("Mail Sent!") 'Destroy the mail object! Set mail = nothing %> |
| < Trước | Tiếp > |
|---|