Sub SendMail_godaddy(ByVal Subject As String, ByVal Body As String, ByVal FromMail As String, ByVal ToMail As String)
Dim objMail As New System.Web.Mail.MailMessage()
objMail.From = FromMail
objMail.To = ToMail
objMail.Subject = Subject
objMail.BodyFormat = Mail.MailFormat.Html
objMail.Priority = Mail.MailPriority.High
objMail.Body = Body
System.Web.Mail.SmtpMail.SmtpServer = UW.Mail.SMTP_SERVER_NAME
System.Web.Mail.SmtpMail.Send(objMail)
End Sub
Sub SendMail_gmail(ByVal Subject As String, ByVal Body As String, ByVal FromMail As String, ByVal ToMail As String)
Dim msg As New System.Net.Mail.MailMessage
Dim client As New System.Net.Mail.SmtpClient
Try
msg.Subject = Subject
msg.Body = Body
msg.From = New System.Net.Mail.MailAddress(FromMail)
msg.To.Add(ToMail)
msg.IsBodyHtml = True
client.Host = "smtp.gmail.com"
Dim basicauthenticationinfo As System.Net.NetworkCredential = New System.Net.NetworkCredential("username@gmail.com", "password")
client.Port = Int32.Parse("587")
client.EnableSsl = True
client.UseDefaultCredentials = False
client.Credentials = basicauthenticationinfo
client.DeliveryMethod = Net.Mail.SmtpDeliveryMethod.Network
client.Send(msg)
Catch ex As Exception
UW.WU.DebugWriteLine(ex.ToString, True, True)
End Try
End Sub
For I As Int32 = 1 To DT.Rows.Count
If order_num_right = DT.Rows(I - 1)("Pid") Then
Pid_No = I - 1
End If
#OFCL.Pid = DT.Rows(I - 1)("Pid")
#OFCL.GetDataRowAndReturnSelfOrNothing()
Dim NewT As String = oT.Result
NewT = NewT.Replace("#Y#", StartY + (I - 1) * LH)
NewT = NewT.Replace("#序號#", I.ToString)
NewT = NewT.Replace("#品號#", OFCL.Pid)
NewT = NewT.Replace("#品名#", OFCL.Product_Name)
NewT = NewT.Replace("#包裝#", OFCL.Package)
NewT = NewT.Replace("#單位#", OFCL.UNIT)
NewT = NewT.Replace("#數量#", OFCL.Qty)
NewT = NewT.Replace("#箱數#", OFCL.BOX)
NewT = NewT.Replace("#總數量#", OFCL.Total)
NewT = NewT.Replace("#未稅價#", OFCL.Price)
NewT = NewT.Replace("#總金額#", OFCL.Sum)
Res &= NewT
Next
Windows 2008 的 SMTP 寄信時若遇到 "Helo command rejected: need fully-qualified hostname" ,可做以下的修改。
The fix is easy: