Tuesday, 15 May 2012

asp.net - Email using smtp not working when deployed in azure -



asp.net - Email using smtp not working when deployed in azure -

i using next code sending email using smtp gmail , works on machine when deployed on azure not working.

seek { // gmail address send mail service var fromaddress = new mailaddress( "k4@gmail.com","from name"); var toaddress = new mailaddress("mghazanfar@hotmail.co.uk", "to name"); const string frompassword = "meabana"; string subject = "feedback comic maker " + request["name"]; string body = request["message"]+"\n\n\n\n\n\n"; body += request["email"]; body += request["phone"]; var smtp = new smtpclient { host = "smtp.gmail.com", port = 587, enablessl = true, deliverymethod = smtpdeliverymethod.network, usedefaultcredentials = false, credentials = new networkcredential(fromaddress.address, frompassword) }; using (var message1 = new mailmessage(fromaddress, toaddress) { subject = subject, body = body }) { smtp.send(message1); scriptmanager.registerclientscriptblock(this, this.gettype(), "alertmessage", "alert('email sent successfully')", true); email.value = ""; phone.value = ""; name.value = ""; message.value = ""; } } grab { scriptmanager.registerclientscriptblock(this, this.gettype(), "alertmessage", "alert('some problem occurred')", true); }

i got error smtp server requires secure connection or client not authenticated. server response was: 5.5.1 authentication required. larn more at

asp.net azure

No comments:

Post a Comment