This used to work on the old server and I got the files backed up and got the system running on the new server. Databases are all intact and connected, files are all there but whenever a user wants to register, they get the “Failure sending mail” error.
This is the line in the registeration file that handles the activation mail sending:
MailClass.MailGonder("info@mysite.com", TxtEMail.Text, "Aktivasyon Kodu", body, "info@mysite.com", "mypasswordishere", "mail.mysite.com", 587);
And this is the Mail_Class.cs file which I’m pretty sure handles the whole mail thing:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Net.Mail;
using System.Net;
namespace Sngl
{
public class MailClass
{
public MailClass() { }
public static void MailGonder(string kimden, string kime, string title, string body, string senderEmail, string senderPassword, string smtpServer, int port)
{
try
{
System.Net.Mail.MailMessage MyMailMessage = new System.Net.Mail.MailMessage(kimden, kime, title, body);
MyMailMessage.IsBodyHtml = true;
MyMailMessage.Priority = System.Net.Mail.MailPriority.High;
System.Net.NetworkCredential mailAuthentication = new
System.Net.NetworkCredential(senderEmail, senderPassword);
System.Net.Mail.SmtpClient mailClient = new System.Net.Mail.SmtpClient(smtpServer, port);
mailClient.EnableSsl = false;
mailClient.UseDefaultCredentials = false;
mailClient.Credentials = mailAuthentication;
mailClient.Send(MyMailMessage);
PropertyClass.Result = true;
}
catch (Exception ex)
{
PropertyClass.Result = false;
PropertyClass.Message = ex.Message;
}
}
}
}
So what am I doing wrong? This used to work on the old server but the guy who set it up for me there doesn’t reply to my emails or calls. I’ve tried for hours trying to get this up and running but nothing works. I tried using the internal subdomain of hosting as mail server, tried using ip and still it’s the same result. double checked everything, the email address is there and the password is the same as the one in the file.
What can I do to know what’s wrong? Any help is appreciated.
Are you sure that the mail server isn’t performing some authentication/security based on source IP?
Can you telnet to the mail server from the web server? e.g. telnet mailserverip port