Failure sending mail

Joined
Oct 8, 2012
Messages
7
Programming Experience
Beginner
hello..
im getting an error message when im sending an email..
FAILURE SENDING MESSAGE

actually mail sends successfully when i do not attach a pdf file, but when i tried to attach a pdf file i always get this error..

ANY IDEA??

VB.NET:
        If System.IO.File.Exists("C:\Users\user\Desktop\10-9 backend\WindowsApplication5\backend\Reports\SellingPriceList.rpt") = True Then
            Dim customerReport As New SellingPriceList()
            Dim reportPath As String = ("C:\Users\user\Desktop\10-9 backend\WindowsApplication5\backend\Reports\SellingPriceList.rpt")
            With customerReport
                .Load(reportPath)
                CrystalReportViewer1.ReportSource = customerReport
                .ExportToDisk(ExportFormatType.WordForWindows, ("C:\Users\user\Desktop\MyReport.doc"))
            End With
        Else
            MessageBox.Show("Your rpt was not found in the following folder: " & vbCrLf & Application.StartupPath)
        End If


        Dim email As New MailMessage()
        email = New MailMessage("bjay.tiamsic26@gmail.com", "bjay.tiamsic26@gmail.com", "Price List", "Price yeah")


        ''//set the reply to address and the to address
        Dim Smtp As New SmtpClient
        Smtp.Host = "smtp.gmail.com"
        Smtp.Port = 587
        Smtp.EnableSsl = True
        Dim usernamePassword As New Net.NetworkCredential("bjay.tiamsic26@gmail.com", "chenelyn")


        Smtp.Credentials = usernamePassword


        ''//Assign the MailMessage's properties
        'mail.Subject = "Your scorecard file"
        'email.Body = "Attached is the file you asked<br />Regards!"
        email.IsBodyHtml = True


        ''//attach the file
        email.Attachments.Add(New Attachment("C:\Users\user\Desktop\MyReport.doc"))




        'Try
        Smtp.Send(email)
 
Hi,

I have just tested your code, with and without attachments, with my own gmail credentials and all works OK. So the structure of your code is fine.

The best suggestion that I can therefore make is that the issue must be something to do with your gmail account. It may be worth having a chat with the guys at gmail.

Cheers,

Ian
 

Latest posts

Back
Top