简体   繁体   中英

Mail client unable to contact smtp server(written in C++)

My smtp server is written in C++. The mail client is in HTML and JS. I use smtpjs library to send mail. Apache for the web server. However, the mail client is unable to contact the smtp server at all. Wireshark does not show any SMTP exchange.

My IP is 192.168.0.105 which is behind a NAT.

  1. I have tried port forwarding and made sure port 25 is set up for port forwarding in the router. But it does not work.
  2. DDNS on the router. To be frank, I am not sure how to set it up. Whatever I tried did not work.
  3. EmailJs website to connect to the SMTP server to check the SMTP connection alone. There is a connection timeout which happens.

     <!DOCTYPE html> <html> <head> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script> <script src="https://smtpjs.com/v3/smtp.js"></script> <script> function showMsg() { $( document ).ready(function() { Email.send({ Host : "192.168.0.105", Username : "shwetha@localhost.com", Password : "123456", To : 'shwetha@localhost.com', From : "shwetha@localhost.com", Subject : "This is the subject", Body : "And this is the body" }).then( message => alert(message) ); }) } </script> 

The expectation is to make sure that the client contacts the smtp server and HELO is exchanged.

Changed the IP to localhost in the Host part of SmtpJS. The next error is "Server does not support secure connections." which means SSL should be enabled on the web server which needs to be figured out.

<!DOCTYPE html>
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
<script src="https://smtpjs.com/v3/smtp.js"></script>
<script>
function showMsg() {
$( document ).ready(function() {
Email.send({
    Host : "localhost",
    Username : "shwetha@localhost.com",
    Password : "123456",
    To : 'shwetha@localhost.com',
    From : "shwetha@localhost.com",
    Subject : "This is the subject",
    Body : "And this is the body"
}).then(
  message => alert(message)
);
})
}
</script>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM