Sending e-mail

  • Thread starter Thread starter Ivan Weiss
  • Start date Start date
I

Ivan Weiss

I have an application where employees fill out forms and they are
e-mailed to the responsibility party once completed. I was planning on
using Microsoft Outlook (since everyone uses it for office e-mail) using
VBA. However, I was wondering if this is a mistake in performance
measures. It is a small app with under 10 users but I would like it to
be scalable and as efficient as possible. Are there better methods than
creating an outlook object in my program and manipulating it to function
as I want?
 
You can use System.Web.Mail

Its hardly 5-6 lines of code to send an email.

private void BtnSend_Click(object sender, System.EventArgs e)
{
MailMessage mail = new MailMessage();
mail.From = txtFrom.Text;
mail.To = "(e-mail address removed)";
mail.Subject = txtSubject.Text;
mail.Body = txtBody.Text ;
mail.BodyFormat = MailFormat.Html;
SmtpMail.Send(mail);
lblPostBack.Text = "Your Feedback has been sent to NetPointer";
}



----- Ivan Weiss wrote: -----

I have an application where employees fill out forms and they are
e-mailed to the responsibility party once completed. I was planning on
using Microsoft Outlook (since everyone uses it for office e-mail) using
VBA. However, I was wondering if this is a mistake in performance
measures. It is a small app with under 10 users but I would like it to
be scalable and as efficient as possible. Are there better methods than
creating an outlook object in my program and manipulating it to function
as I want?
 
Yes VB.net has a System.Web.Mail.MailMessage:

Try this and edit the server, and email portions.

hth
Robert

Sub sendPasswordReSetEmail()
'Send email to user to let them know their password is reset
Dim Message As New System.Web.Mail.MailMessage()
Dim SB As New System.Text.StringBuilder()
Dim S As String

'Recipient's name and e-mail address
Message.To = txtDisplayName.Text & "<" & txtLogonName.Text &
"@test.com>"
'Your name and e-mail address
Message.From = "Admin (e-mail address removed)"
'Message body

SB.Append("Your computer account password has been reset.\n")
SB.Append("Your password is " & txtPassword.Text)
SB.Append("Please change it to another password after you login")
SB.Append("thank you \n")
SB.Append("Admin \n")
Message.Body = SB.ToString.Replace("\n", vbCrLf)
Message.Subject = "YourComputer account"
'Your smtp server
System.Web.Mail.SmtpMail.SmtpServer = "smtp.server.com"

Try
System.Web.Mail.SmtpMail.Send(Message)
'MessageBox.Show("Your mail has been successfully sent!")
Catch ex As Exception
MessageBox.Show("The following problem occurred when attempting
to send your mail: " & ex.Message)
End Try

End Sub
 
Back
Top