Posts

Showing posts from July, 2013

Send mail have text and image content.

   การเขียนโปรแกรมสามารถส่งเมลล์ที่เป็๋นข้อความได้ตามปกติอยู่แล้ว มีอยู่วันนึงต้องทำการส่งเมลล์โดยให้ทำการแนบไฟล์ที่เป็นรูปภาพเข้าไปด้วย แต่รูปนั้นต้องเป็นรูปที่แสดงอยู่ในลักษณะอยู่ในเนื้อข้อความเลย โดยที่ไม่ต้อง Double Click เพื่อดูรูปนั้นๆ    วันนี้จึงจะมาแชร์โปรแกรมให้ดูกันว่าเขียนยังไง โดยมีทั้งสองแบบเลย แบบที่1 คือรูปที่นำมาแสดงจากไฟล์ และแบบที่2 คือรูปที่นำมาแสดงจากฐานข้อมูล ดังนี้ 1. ทำการนำเข้า Library ที่ต้องการใช้งานก่อน Import System.net.mail 2. กำหนดตัวแปรที่จำเป็นต้องใช้ในการส่งเมลล์ Dim myMail As New MailMessage() Dim MailClient As New SmtpClient("smtp.company.com") Dim myBody As String = "" myMail.From = New MailAddress("prompratan@gmail.com", "Prompratan Nakajakawan") myMail.To.Add("prompratan@gmail.com") myMail.IsBodyHtml = True 3. กำหนด Subject ตามใจชอบ myMail.Subject = "This is e-mail advanced feature..." 4. กำหนด Body ตามใจชอบ แต่ถ้าต้องการให้ส่วนไหนเป็นรูปให้ใส่ดังนี้  <img sr

Search user for Account option is Password never expires.

Syntax : dsquery * domainroot -filter "(&(objectClass=user) (userAccountControl>=65536))" -attr sAMAccountName userPrincipalName userAccountControl -d Example : dsquery * domainroot -filter "(&(objectClass=user) (userAccountControl>=65536))" -attr sAMAccountName userPrincipalName userAccountControl -d mydom.local Reference   http://ckerekes.com/dsquery.shtml

Search users by group and save to file

dsquery group -name "Group Name" |DSGET group -members > C:\User.txt