How do I send a gmail email in vb.net?

前端 未结 6 1634
情书的邮戳
情书的邮戳 2021-01-05 20:49

I want to send an email, but it gives me an error.

I have this code:

Sub sendMail(ByVal title As String, ByVal content As String)
    Dim SmtpServer          


        
6条回答
  •  自闭症患者
    2021-01-05 21:47

    A super easy way of doing this(without changing any security settings) is by using IFTTT and my IFTTT Maker.net libary

    First, in IFTTT create a new recipe that's triggered by the Maker channel and name the event "send_gmail".

    Then, select the Gmail engine and click "Send an email", and replace To with {{value1}}, subject with {{value2}} and message/body with {{value3}}

    After that, in Visual studio, add ifttt.vb to your project. Now for the code:

          Try
        makechannel.scode = "your account ID"
        makechannel.fireevent("send_gmail", "TO", "SUBJECT", "MESSAGE")
       'code goes here if done
        Catch ex As Exception
            'code goes here if it fails
        End Try
    

    Then fill in your account ID. You can find it at ifttt.com/maker

    And that's it!

提交回复
热议问题