Results 1 to 2 of 2

Thread: Missing Paper clip icon in gmail

  1. #1
    yuan22m is offline VB.NET Forum Newbie
    .NET Framework
    .NET 3.5 (VS 2008)
    Join Date
    Jul 2009
    Posts
    8
    Reputation
    0

    Missing Paper clip icon in gmail

    Hi,

    I dont know if someone had encountered this problem.
    I used the code below to send email with a google account. I can send the email with attachment but a minor problem for recipient using gmail. I notice that the paper clip image or icon on the right side of the the gmail inbox list is missing (that indicates that there is an attachment on the email) although the email itself has an attachment. Theres no problem with yahoomail and hotmail.
    Did i miss any in the code?
    Thanks a lot.
    Yuan



    Private Function SendEmail(ByVal mRecipient As String, ByVal mSubject As String, ByVal mContent As String) As Boolean
    Dim MyMailMessage As New MailMessage()
    Dim mPlainText As String = ""
    MyMailMessage.From = New MailAddress(getAccount("emailaccount"), getAccount("sender"))
    MyMailMessage.To.Add(New MailAddress(mRecipient))
    MyMailMessage.Subject = mSubject
    'MyMailMessage.Body = mContent

    MyMailMessage.BodyEncoding = System.Text.Encoding.GetEncoding("utf-8")
    'first we create the Plain Text part
    mPlainText = stripHTML(mContent)
    If mPlainText = Nothing Then
    mPlainText = "The email sent is in html format."
    End If
    Dim plainView As AlternateView = AlternateView.CreateAlternateViewFromString(mPlain Text, Nothing, "text/plain")
    'then we create the Html part
    Dim htmlView As AlternateView = AlternateView.CreateAlternateViewFromString(mConte nt, Nothing, "text/html")
    MyMailMessage.AlternateViews.Add(plainView)
    MyMailMessage.AlternateViews.Add(htmlView)

    MyMailMessage.IsBodyHtml = True
    If Me.txtAttachment.Text <> "" Then
    'For counter = 0 To ListBox1.Items.Count - 1
    Dim Attach As Net.Mail.Attachment = New Net.Mail.Attachment(Me.txtAttachment.Text.Trim)
    MyMailMessage.Attachments.Add(Attach)
    'Next
    End If
    Dim SMTPServer As New SmtpClient(getAccount("smtpserver"))
    If getAccount("port") <> "" Then
    SMTPServer.Port = CInt(getAccount("port"))
    End If
    SMTPServer.Credentials = New System.Net.NetworkCredential(getAccount("emailacco unt"), getAccount("password"))
    SMTPServer.EnableSsl = CBool(getAccount("isSSL"))
    Try

    SMTPServer.Send(MyMailMessage)
    'MessageBox.Show("Email Sent")
    Return True
    Catch ex As SmtpException
    MsgBox("" & ex.Message & " ", MsgBoxStyle.OkOnly, "Error on sending email.")
    Return False
    End Try
    End Function

  2. #2
    yuan22m is offline VB.NET Forum Newbie
    .NET Framework
    .NET 3.5 (VS 2008)
    Join Date
    Jul 2009
    Posts
    8
    Reputation
    0

    Solution: Missing Paper clip icon in gmail

    I finally found the solution for this problem by adding content disposition.

    Dim disposition As System.Net.Mime.ContentDisposition = Attach.ContentDisposition
    disposition.DispositionType = "attachment"
    disposition.FileName = System.IO.Path.GetFileName(Me.txtAttachment.Text.T rim)

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Harvest time tracking