2012-12-10 15 views
5

Web güvenli kullanımlı e-postaları Sendgrid'e web api kullanarak gönderemiyorum. (Platform - .Net/C#, SendgridMail)Web günlüğü kullanarak Sendgrid'te güvenli e-posta gönderilemiyor

http url (http://sendgrid.com/api/mail.send) ile birlikte çalışır ancak https (https://sendgrid.com/api/mail) .send) başarısız olur.

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); 
    } 

Bir ArgumentException alıyorum: Bilinmeyen öğe: html. "400 Geçersiz İstek, düz HTTP isteği HTTPS bağlantı noktasına gönderildi/0.7.65 nginx"

Not
O ile çalışıyor:

, bu hatayı kodu aşağı

ayrıntılı sondaj almak http: // url yani: (http://sendgrid.com/api/mail.send) GetInstance işlevinin yerine yukarıdaki (https://sendgrid.com/api/mail.send). tarayıcısı üzerinden e-posta isteği gönderme

çalışıyor: (https://sendgrid.com/api/mail.send.json?to=to%40somedomain.com1 & den% from = 40somdomain.com1 & subject = Testi% 20SG% 20API & metin = sometext & hTML =% 3CB% 3E% 20Test% 20SG% 20api% 20body & api_user = sendgridusername & api_key = sendgridpassword) bu konuda

bir yardım takdir edilmektedir.

+0

Amazon sesine geçin, yaptık, sendgrid'e kıyasla çok daha profesyonel ve eğer doğru bir şekilde kurulum yapılacağını biliyorsanız, bildirimleri de alabilirsiniz. https://nuget.org/packages/Sendgrid –

+0

C# paketi güncelledik. – bwest

cevap

4

Ben SendGrid için çalışıyorum. Bazı testler yaptım ve bu, C# sarmalayıcısının, özellikle de HTTP çağrılarını yapmak için kullanılan CodeScales kitaplığının bir sınırlamasıdır. CodeScales ne yazık ki HTTPS'yi desteklemiyor. Bunun için GitHub'da bir sorun açtım: https://github.com/sendgrid/sendgrid-csharp/issues/21

Uygulamanın, API çağrılarını yapmak için RestSharp kullanacak şekilde yeniden düzenlenmesini planlamaya başlayacağım. Sorun için üzgünüm!

+1

Değişiklikler hataları düzeltmek için 2 gün önce yayınlandı: HTTPS çalışacak böylece – bwest

+0

Çok teşekkürler! – user1891155