No announcement yet.

VB.NET & Email

  • Filter
  • Time
  • Show
Clear All
new posts

  • VB.NET & Email

    I'm moving to Philly next month to take on my new role at Comcast in the Corporate office (go me) as a developement manager and I'm trying to develop a little something of my own on the side for one of our VP's and it doesn't want to work properly.

    The use of this is when a user logs on to a site in the network I grab their global directory listing components using directoryservices and then upload to our SQL server until approved for access. I also send an email to the Admins group that a request needs to be processed and one to the user that we are reviewing the request for access and then another after they have either been granted or denied access. All this works fine except I don't want my email appearing in the email to the user so that they would be able to reply. I just want the name of the website to be the From address.

    So sending the email with the websites name as the alias works but just following the alias it shows my email address. How can I have VB.NET just send the email with the "FAKE NAME OF SENDER"?

    This is the code I'm using with some security items renamed/removed:
    Dim smtp As New System.Net.Mail.SmtpClient("INTERNAL.SMTP.SERVER")
    Dim msg As New System.Net.Mail.MailMessage
    Dim sBody As String = ""
    sBody = "Access request has been made to ACME WIDGET by the following individual…”
    msg.From = New System.Net.Mail.MailAddress("", "FAKE NAME OF SENDER")
    msg.To.Add(New System.Net.Mail.MailAddress(lblEntryEmail.Text))
    msg.Subject = "Access Request to ACME WIDGET"
    msg.Body = sBody
    msg.IsBodyHtml = True