send email in c#

前端 未结 6 1587
猫巷女王i
猫巷女王i 2021-01-28 04:56

i\'ve tried to send email using this code..but an error occurred in smtp.Send(mail); messaging \"Failure sending mail\"

  MailMessage mail = ne         


        
6条回答
  •  温柔的废话
    2021-01-28 05:28

    In your code specify port number:

    SmtpClient smtp = new SmtpClient("smtp.gmail.com", 587)
    

    Also check out this thread Sending email through Gmail SMTP server with C#

提交回复
热议问题