Calvin Tedja
Calvin Tedja

Reputation: 3

Why does Sendgrid API show error in VB.net?

I get this error:

Could not load file or assembly 'SendGrid.SmtpApi, Version=1.1.3.0, Culture=neutral, PublicKeyToken=55aa52d3c3c0d2b2' or one of its dependencies. The system cannot find the file specified.

Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
    ' Create the email object first, then add the properties.
    Dim myMessage As SendGridMessage
    myMessage = New SendGridMessage()

    ' Add the message properties.
    myMessage.AddTo("[email protected]")
    myMessage.From = New MailAddress("[email protected]")

    myMessage.Subject = "Test Sendgrid"

    ' Add plain text body only:
    myMessage.Text = "Body"

    Dim username As String
    Dim pswd As String
    username = "username"
    pswd = "password"

    Dim credentials As NetworkCredential

    credentials = New NetworkCredential(username, pswd)
    ' // Create an Web transport for sending email
    Dim transportWeb As New Web(credentials)
    transportWeb.DeliverAsync(myMessage)

End Sub

Screenshot: https://i.sstatic.net/5DaZZ.png

Please help

Upvotes: 0

Views: 182

Answers (1)

B. Seberle
B. Seberle

Reputation: 395

Perhaps you could try:

 Dim myMessage As SmtpApi.SendGridMessage
    myMessage = New SmptApi.SendGridMessage()

Upvotes: 0

Related Questions