I couldn't send mail using smtp ASPMX.L.GOOGLE.COM. I have domain domain.co.in and email address [email protected] which is accessible in gmail. i Could send mail manually but not programmatically. throws below error. Service not available, closing transmission channel. The server response was: 4.7.0 [61.16.142.134 15] Our system has detected that this message is
MailAddress ma_from = new MailAddress("[email protected]", "fromName");
MailAddress ma_to = new MailAddress("[email protected]", "fromName");
string s_password = "TestPwd";
string s_subject = "Test";
string s_body = "This is a Test";
SmtpClient smtp = new SmtpClient
{
Host = "ASPMX.L.GOOGLE.COM",
Port = 25,
EnableSsl = true,
DeliveryMethod = SmtpDeliveryMethod.Network,
UseDefaultCredentials = false,
Credentials = new NetworkCredential(ma_from.Address, s_password)
};
using (MailMessage mail = new MailMessage(ma_from, ma_to)
{
Subject = s_subject,
Body = s_body
})
smtp.Send(mail);
Where did you get those settings? I don't think port 25 will work with SSL. Try port 587 and host "smtp.gmail.com"
The full response from Google would help. Was it perhaps "Our system has detected an unusual rate of unsolicited mail originating from your IP address. To protect our users from spam, mail sent from your IP address has been temporarily rate limited." Note that unless you're using a fixed-line internet connection from home, you're probably sharing an IP address with many other users.
Ensure you have a "strong" password
Ensure the "from" email address is your primary email address and not an alias.