Send EMail with Attachment

May 1, 2015 at 9:33 AM
Hi

I have just started to use this beautifully created wrapper. I was able to make it work to send an email using my mandrill account, but as soon as I am trying to send it with attachment I enter into a mess, I know its something silly that I am not able to understand but some one can please help me fix this below is my code
Dim api = New MandrillApi(GetKey())
        Dim recipients = New List(Of Mandrill.Messages.Recipient)()        
        recipients.Add(New Mandrill.Messages.Recipient("someemail@gmail.com", "somename"))        


        'Dim atch As New Mandrill.Messages.Attachment("text/plain", "testattach.txt", True, File.ReadAllBytes("C:\Users\nirav.vyas.GALAXY\Desktop\testattach.txt").ToString)
        'Dim attachs = New Opt(Of MailChimp.Types.Mandrill.Messages.Attachment)(atch)
        'Dim attachs1(0) As Opt(Of MailChimp.Types.Mandrill.Messages.Attachment())
        'attachs1(0) = atch


        Dim mesage = New Mandrill.Messages.Message()
        mesage.To = recipients.ToArray()
        mesage.FromEmail = "noreply@freemindtech.com"
        mesage.FromName = "Nirav"
        mesage.Subject = "Test Email"
        mesage.Html = "<div>Test</div><br/><br/><div><a href='www.google.com'>Lets test the link of other website, click me.</a></div><div><p>Below is test to see if images works</p><br/><br/><img src='http://www.nemopdf.com/images/knowledge/upload-files.jpg' alt='myimage' /></div>"
        'mesage.Attachments = attachs1

        Dim result As MVList(Of Mandrill.Messages.SendResult)
        result = api.Send(mesage)
if you see the commented code , that is where I am not able to figure it out. can someone please help me fix that code

Thanks
Nirav