E
Edward
I use the function below to send email from my ASP.NET application.
When I last visited it about three weeks ago, it would display the
mail message on screen and require me (the user) to send it manually.
The sent message would appear in my "Sent" messages folder.
Now, having made no changes, it sends the message silently, in the
background, and sent messages do *NOT* appear in the "Sent" messages
folder. I know the message has been sent because I tested it with one
of my other email addresses.
I prefer the former functionality. Any ideas, anyone?
TIA
Edward
Public Sub SendEmail(ByVal TSRs As StringBuilder, ByVal MailTo As
String)
Dim mailMsg As New MailMessage()
Dim sbMessage As New StringBuilder()
' Build the email message body.
sbMessage.Append(Me.EmailSalutation & " " & Name)
sbMessage.Append(vbCrLf)
sbMessage.Append(vbCrLf)
sbMessage.Append(Me.EmailHeader)
sbMessage.Append(vbCrLf)
sbMessage.Append(TSRs.ToString)
sbMessage.Append(vbCrLf)
sbMessage.Append(Me.EmailFooter)
sbMessage.Append(vbCrLf)
sbMessage.Append(vbCrLf)
sbMessage.Append(Me.EmailValediction)
sbMessage.Append(vbCrLf)
sbMessage.Append(vbCrLf)
sbMessage.Append(LogonUser.UserFullName)
With mailMsg
.From = LogonUser.Email
.To = MailTo
.Subject = Me.EmailSubjectLine
.Body = sbMessage.ToString
End With
' Set the SmtpServer name. This can be any of the following
depending on
' your local security settings:
' a) Local IP Address (assuming your local machine's SMTP server has
the
' right to send messages through a local firewall (if present).
' b) 127.0.0.1 the loopback of the local machine.
' c) "smarthost" or the name or the IP address of the exchange
server you
' utilize for messaging. This is usually what is needed if you are
behind
' a corporate firewall.
SmtpMail.SmtpServer = "127.0.0.1"
Try
SmtpMail.Send(mailMsg)
Catch exp As Exception
End Try
End Sub
When I last visited it about three weeks ago, it would display the
mail message on screen and require me (the user) to send it manually.
The sent message would appear in my "Sent" messages folder.
Now, having made no changes, it sends the message silently, in the
background, and sent messages do *NOT* appear in the "Sent" messages
folder. I know the message has been sent because I tested it with one
of my other email addresses.
I prefer the former functionality. Any ideas, anyone?
TIA
Edward
Public Sub SendEmail(ByVal TSRs As StringBuilder, ByVal MailTo As
String)
Dim mailMsg As New MailMessage()
Dim sbMessage As New StringBuilder()
' Build the email message body.
sbMessage.Append(Me.EmailSalutation & " " & Name)
sbMessage.Append(vbCrLf)
sbMessage.Append(vbCrLf)
sbMessage.Append(Me.EmailHeader)
sbMessage.Append(vbCrLf)
sbMessage.Append(TSRs.ToString)
sbMessage.Append(vbCrLf)
sbMessage.Append(Me.EmailFooter)
sbMessage.Append(vbCrLf)
sbMessage.Append(vbCrLf)
sbMessage.Append(Me.EmailValediction)
sbMessage.Append(vbCrLf)
sbMessage.Append(vbCrLf)
sbMessage.Append(LogonUser.UserFullName)
With mailMsg
.From = LogonUser.Email
.To = MailTo
.Subject = Me.EmailSubjectLine
.Body = sbMessage.ToString
End With
' Set the SmtpServer name. This can be any of the following
depending on
' your local security settings:
' a) Local IP Address (assuming your local machine's SMTP server has
the
' right to send messages through a local firewall (if present).
' b) 127.0.0.1 the loopback of the local machine.
' c) "smarthost" or the name or the IP address of the exchange
server you
' utilize for messaging. This is usually what is needed if you are
behind
' a corporate firewall.
SmtpMail.SmtpServer = "127.0.0.1"
Try
SmtpMail.Send(mailMsg)
Catch exp As Exception
End Try
End Sub