Non riesco a inviare e-mail "sicure" su Sendgrid usando web api. (Piattaforma - .Net/C#, SendgridMail)Impossibile inviare e-mail sicure su Sendgrid usando webapi
Funziona bene con http url (http://sendgrid.com/api/mail.send) ma con https (https://sendgrid.com/api/mail .send) fallisce.
private void SendMail()
{
var message = SendGrid.GenerateInstance();
//set the message recipients
message.AddTo("[email protected]");
//set the sender
message.From = new MailAddress("[email protected]");
//set the message body
message.Html = "<html><p>Hello</p><p>World</p></html>";
//set the message subject
message.Subject = "Hello World HTML Test";
//create an instance of the Web transport mechanism
var transportInstance = SendGridMail.Transport.REST.GetInstance(new NetworkCredential("myusername", "mypassword"),"https://sendgrid.com/api/mail.send");
//send the mail
transportInstance.Deliver(message);
}
Ottengo un argomentoExclusione: elemento sconosciuto: html.
seguito di perforazione lungo il codice, ricevo questo errore: "400 Bad Request, La richiesta HTTP pianura è stata inviata a porta HTTPS, nginx/0.7.65"
Nota
funziona benissimo con http: url: (http://sendgrid.com/api/mail.send) nella funzione GetInstance sopra invece di (https://sendgrid.com/api/mail.send).
Invio richiesta e-mail attraverso il browser funziona bene: (https://sendgrid.com/api/mail.send.json?to=to%40somedomain.com1 & from = da% 40somdomain.com1 & subject = test% 20SG% 20API & testo = someText & html =% 3CB% 3E% 20Test% 20SG% 20api% 20body & api_user = sendgridusername & api_key = sendgridpassword)
Un aiuto su questo è apprezzato.
Passa a Amazon ses, l'abbiamo fatto, è molto più professionale rispetto a sendgrid e, se sai come configurare correttamente sns, puoi anche ricevere le notifiche. –
Ho aggiornato il pacchetto C# in modo che HTTPS funzioni: https://nuget.org/packages/Sendgrid – bwest