Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. Problem sending EMail

Problem sending EMail

Scheduled Pinned Locked Moved Visual Basic
csharpsysadminwindows-adminhelpquestion
1 Posts 1 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • P Offline
    P Offline
    Pankaj Garg
    wrote on last edited by
    #1

    Hi All, I am using the following code to send EMail

    Public Function SendmailUsingSmtpClient(ByVal destinationEmail As List(Of String), ByVal subject As String, ByVal body As String) As Boolean ', ByVal pblnNotify As Boolean) As Boolean
    'Dim Email As New System.Net.Mail.MailMessage
    Dim mailClient As SmtpClient = Nothing
    ' Dim smtp As New System.Net.Mail.SmtpClient(BLLmdlCommon.SmtpServer, BLLmdlCommon.SmtpServerPort)
    Dim cred As NetworkCredential = Nothing
    Dim smtpserver As String = ""
    Dim SendPassword As String = ""
    Dim fromMail As String = ""
    Dim smptServerPort As String = ""
    Dim SendUserName As String = ""
    Try
    SendPassword = System.Configuration.ConfigurationManager.AppSettings("fromemailpassword").ToString()
    fromMail = System.Configuration.ConfigurationManager.AppSettings("FromEmail").ToString()
    smtpserver = System.Configuration.ConfigurationManager.AppSettings("smtpserver").ToString()
    smptServerPort = System.Configuration.ConfigurationManager.AppSettings("SmtpServerPort").ToString()

            mailClient = New SmtpClient(smtpserver, smptServerPort)
            '  mailClient.EnableSsl = True
            mailClient.DeliveryMethod = SmtpDeliveryMethod.PickupDirectoryFromIis
            mailClient.UseDefaultCredentials = False
            cred = New NetworkCredential(fromMail, SendPassword)
            mailClient.Credentials = cred
            For i As Integer = 0 To destinationEmail.Count - 1
                mailClient.Send(fromMail, destinationEmail(i), subject, body)
            Next
            Return True
        Catch ex As Exception
            Throw ex
            Return False
        End Try
    End Function
    

    It is working fine at local. When i check at production server, it is crashing, Cannot get IIS pickup directory Can you tell me something , Whay should i do to get rid of this problem? Thanks

    1 Reply Last reply
    0
    Reply
    • Reply as topic
    Log in to reply
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes


    • Login

    • Don't have an account? Register

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • World
    • Users
    • Groups