Cannot send mail via client
Posted: 2020-10-24 13:13
I had my hmailserver account setup, with local domain I have made
I am using windows and running the services on my PC (not windows server)
first of all my test logs:
I am using C# program code as the client, it is also sits on the same windows as the hmailserver I will show you the code (not all of it, just the important mail sending part.).
The appsetting.json:
basically it takes the information from the json file into the program, such as host name etc.
now I tried on cmd the following :
Also :
going into https://www.myip.com/ and typing the ip shown on cmd:
also:
trying to run the program with my local ip shown on the website inside 'host' in json results in:
trying to put 5.189.183.138 in 'host' :
trying something else can result in no host found..
Hope I provided enough information for you to help me figure this out
I am using windows and running the services on my PC (not windows server)
first of all my test logs:
Test: Collect server details
hMailServer version: hMailServer 5.6.7-B2425
Database type: MSSQL Compact
Test: Test IPv6
IPv6 support is available in operating system.
Test: Test outbound port
SMTP relayer not in use. Attempting mail.hmailserver.com:25...
Trying to connect to host mail.hmailserver.com...
Trying to connect to TCP/IP address 5.189.183.138 on port 25.
Received: 220 mail.hmailserver.com ESMTP.
Connected successfully.
Test: Test backup directory
ERROR: Backup directory has not been specified.
Test: Test MX records
Trying to resolve MX records for mydomain.com...
ERROR: MX records for domain mydomain.com could not be resolved
Test: Test local connect
Connecting to TCP/IP address in MX records for local domain domain mydomain.com...
ERROR: MX records for local domain makechange.com could not be resolved
Test: Test message file locations
Relative message paths are stored in the database for all messages.
Test: Test IP range configuration
No problems were found in the IP range configuration.
I am using C# program code as the client, it is also sits on the same windows as the hmailserver I will show you the code (not all of it, just the important mail sending part.).
Code: Select all
class SmartMassMailer
{
static IConfigurationRoot Configuration { get; set; }
static SmtpClient SmtpClient { get; set; }
static SmartMassMailer()
{
var builder = new ConfigurationBuilder()
.AddJsonFile("appsettings.json");
Configuration = builder.Build();
SmtpClient = new SmtpClient(Configuration["smtpSettings:host"])
{
UseDefaultCredentials = false,
Credentials = new NetworkCredential(
Configuration["smtpSettings:username"],
Configuration["smtpSettings:password"])
};
Encoding.RegisterProvider(CodePagesEncodingProvider.Instance);
}
static void SendEmail(string recipientEmail, string subject, string bodyHtml)
{
var msg = new MailMessage
{
From = new MailAddress(
Configuration["fromEmail"],
Configuration["fromName"]),
IsBodyHtml = true,
Body = bodyHtml,
BodyEncoding = Encoding.UTF8,
SubjectEncoding = Encoding.UTF8,
HeadersEncoding = Encoding.UTF8,
Subject = subject
};
msg.To.Add(recipientEmail);
SmtpClient.Send(msg);
}
Code: Select all
{
"fromName": "from_name",
"fromEmail": "domainname@mydomain.com",
"emailSubject": "email_subject",
"emailHtmlTemplate": "email-template.html",
"recipientsExcelFile": "recipients.xlsx",
"smtpSettings": {
"host": "my_local_ip ? ", <--- I have tried multiple combinations here, not sure what to use, nothing works tough
"username": "domainname@domainname.com",
"password": "password"
},
"delayBetweenEmailsMilliseconds": 7000,
"startRow": 1
}
now I tried on cmd the following :
Code: Select all
> telnet localhost 25
220 mail.mydomain.com ESMTP
Code: Select all
>netstat -na | find ":25" | find "LISTENING"
TCP 0.0.0.0:25 0.0.0.0:0 LISTENING
Code: Select all
>telnet *my_ip* 25
Connecting To *my_ip*...Could not open connection to the host, on port 25: Connect failed
Code: Select all
>telnet mail.hmailserver.net 25
Connecting To mail.hmailserver.net...Could not open connection to the host, on port 25: Connect failed
A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond *my_ip*:25
trying to put 5.189.183.138 in 'host' :
also inside hmailserver -> ip range -> require smtp authentication, everything is unchecked except 'external to external email adderess''The SMTP server requires a secure connection or the client was not authenticated. The server response was: SMTP authentication is required.'
trying something else can result in no host found..
Hope I provided enough information for you to help me figure this out