Advertisement

06.07.2008 at 11:40PM PDT, ID: 23466928
[x]
Attachment Details

Error in sending mail using SmtpClient

Asked by DarknessShadow in Simple Mail Transfer Protocol (SMTP), SendMail Email Server, Visual Studio

Tags:

Dears Experts,
I tried to send email and attached a file to it from VB.NET code using the SmtpClient, but unfortunatily when I exexuted the code I got the following error. Could you please adivce

Module Module1

    Sub Main()
        pushMail("SDP-Daily", "SDP-Daily@mycom.com", "me@mycom.com", "SDP-Daily")
    End Sub
    Public Sub pushMail(ByVal senderName As String, ByVal from As String, ByVal toAddress As String, ByVal subject As String)
        Dim objMail As New System.Net.Mail.MailMessage
        Dim addrss As System.Net.Mail.MailAddress = New System.Net.Mail.MailAddress(from)
        objMail.From = addrss
        objMail.To.Add(toAddress)
        objMail.Subject = subject
        'objMail.IsBodyHtml = True
        objMail.Body = "test"
        Dim objAttch As Net.Mail.Attachment = New Net.Mail.Attachment("C:\SDP-07042008.xls")

        objMail.Attachments.Add(objAttch)
        Dim client As System.Net.Mail.SmtpClient = New System.Net.Mail.SmtpClient("RUH-003-MX-001") 'the Client used in our lan
        Try
            client.Send(objMail)
            objMail.To.Clear()
        Catch ex As Exception
        End Try
    End Sub
End Module
Start Free Trial
[+][-]06.08.2008 at 06:19AM PDT, ID: 21738295

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]06.08.2008 at 10:53PM PDT, ID: 21741191

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]06.09.2008 at 02:39AM PDT, ID: 21741894

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]06.09.2008 at 03:00AM PDT, ID: 21741964

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]06.09.2008 at 04:51AM PDT, ID: 21742422

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: Simple Mail Transfer Protocol (SMTP), SendMail Email Server, Visual Studio
Tags: VB.NET
Sign Up Now!
Solution Provided By: emoreau
Participating Experts: 1
Solution Grade: B
 
 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628