c# - Unable to send mail with gmail credentials from godaddy server -
am using asp.net , have written smtp client send mail out using gmail. works fine if use vs debugger or if host on pc (localhost) while doesn't work if hosted on godaddy server. called technical support know if there specific setting missed declined share info. here c# code.
smtp = new smtpclient(); = new mailaddress("xxxxxxx@gmail.com"); = new mailaddress(toaddr); message = new mailmessage(from, to); message.cc.add(cclist); message.subject = subject; message.body = body; smtp.deliverymethod = smtpdeliverymethod.network; smtp.usedefaultcredentials = true; smtp.credentials = new system.net.networkcredential("xxxxxxx@gmail.com", "password"); smtp.host = "smtp.gmail.com"; smtp.enablessl = true; smtp.port = 587; smtp.timeout = (60 * 5 * 1000); smtp.deliverymethod = smtpdeliverymethod.network; smtp.send(message);
tried sending gmail using port 25 , 485 suggested dint work out. forward support.
i getting socket closed error though using appropriate port numbers with/without ssl. dint work. work around have right using domain email id send out emails , works suggested. link found same: https://www.godaddy.com/help/send-email-using-systemnetmail-19291
thank guys. cheers.
Comments
Post a Comment