How to use TidSMTP when mailserver has no smtp but ip only - delphi

i developed an application that sends email messages using indy (idSMTP + SSL).
The idSMTP properties I expose to the user are simply:
host
user
password
anyway in some cases the users have an internal mailsender that doesn't have an smtp address, but simply an internal ip (like 192.168.48.63) and no user and no password.
i tried to set host = id but it doesn't work.
Could you sugeest a solution?

Related

Postfix Connection Timeout for Outgoing Mail - Port 25 is ***not*** blocked by ISP

Many similar questions have been asked here, but most have the issue of port 25 being blocked by a cloud provider (i.e. DigitalOcean) or the ISP (i.e. Xfinity). I have neither of these problems, but still can't send outgoing mail.
I try to send outgoing mail, but get this error from posfix/smtp
connect to alt2.gmail-smtp-in.l.google.com[142.250.152.27]:25: Connection timed out
I am running a postfix from a spare laptop that is running Ubuntu Server, so I know it isn't a problem with a cloud provider. Additionally, I have Google Fiber, and they do not block any ports, including port 25. Just as a test, when I telnet to the above address, I can successfully connect.
$ telnet alt2.gmail-smtp-in.l.google.com 25
Trying 2607:f8b0:4001:c56::1a...
Connected to alt2.gmail-smtp-in.l.google.com.
Escape character is '^]'.
220 mx.google.com ESMTP x17si5369573iow.10 - gsmtp
Any ideas what the final blocker is? The one thing I can think of is my postfix main.cf variables below might need tweaking. Also, FYI I am running the postfix server in a Docker container.
mydestination = localhost.$mydomain, localhost
proxy_interfaces = X.X.X.X # Static IP of Google Fiber router that is externally facing to WAN
After some digging, I looked up my hostname on Realtime Blackhole Lists, or RBLs, and discovered that my hostname and therefore mail server were being rejected as spam by any mail server that checks the public RBLs.
The solution to this was to set up SPF, DKIM, and DMARC through my DNS provider. Each of these play a role in reducing hostname spoofing, spam email, and other malicious activites. There are many tutorials online on how to do this.
SPF is Sender Policy Framework. This is used to prevent others from spoofing your domain.
DKIM is DomainKeys Identified Mail. This allows the senders to authenticate their emails by including a digital signature in the email header. DKIM uses public-key cryptography to verify that an email message was sent from an authorized mail server.
DMARC is Domain-based Message Authentication Reporting & Conformance, which builds on SPF and DKIM to prevent domain spoofing.

Implementing Mail Server using TIdSMTPServer

I have acquired the domain name - xyz.in from GoDaddy.com and also acquired the mail ID - info#xyz.in. And currently, I can able to send 500 mails by using GoDaddy.
So, I'm thinking to implement my Mail Server using Delphi - TIdSmtpServer. I found few samples but for sending mails how can I use the sender ID as info#xyz.in and send mails. As I need to send only mails, what are the other settings and please provide some basic sample code.
Thanks in advance.
SMTP is one-way, from sender to receiver. You cannot send emails with TIdSMTPServer, only receive them. Your SMTP server needs to store received emails as needed for you to retrieve them later, via POP3/IMAP, or whatever custom system you want to make.
When someone wants to send an email to you at info#xyz.in, they perform a DNS lookup of the MX record for xyz.in, then connect to that server and issue SMTP commands to deliver the email to the info mailbox 1. So you need to configure your domain's DNS MX record to point at the IP address of your SMTP server machine.
To send an email from your system to someone else, use TIdSMTP instead, so it can connect to and send the email to the other person's SMTP server. You can use TIdDNSResolver to lookup a domain's MX records to find the IP address(es) to connect to 1.
1: most users send an outgoing email through their ISP's own SMTP server and let it relay the email to each recipient's domain SMTP server as needed. And use their ISP's SMTP server to receive emails. This is easier for users to use and configure, and it is safer as it allows ISPs to implement security and anti-spam measures. So you may end up sticking with GoDaddy's SMTP server instead of running your own in the long run.

Client server login

I have a server available which can be reached via an IP address and port 22. The server can only be accessed via a username and password. If I send the assignment "getinfo" to the server, it will give some text which I need.
I can access this via an SSH client, like KITTY, but how do I do this in Delphi?
I assume that the TIdTCPClient component will suffice, but I do not understand how a login can be implemented.

Send / Receive Emails through external VServer with Plesk?

I have:
Google Cloud Engine (Google does not allow to Send Mails)
Domain (GoDaddy)
External VServer with Plesk.
I want to user my VServer as an external Mailserver.
But i don´t know what to write in the "CName (Alias)" and "MX (Mail Exchanger)".
And where do i have to point my imap.server.tld and smtp.server.tld in my Emailclient?
to imap.plesk-vserver.tld or to imap.my-regualar.tld
What´s about the origin of my emails i send out?
Do i need to configure Plesk as well?
Here how to Receive emails on Plesk server:
Assume that your "Domain (GoDaddy)" = domain.tld
In "Domain (GoDaddy)":
create new DNS record for MX
create new A record to point MX on plesk server IP
Where 1.2.3.4 - it's IP of your plesk server
In Plesk create new subscription or new add-on domain with name "domain.tld"
Point your email client for IMAP on IP address of Plesk server.
To Send emails from "Google Cloud Engine" I recommend to use some external service like SendGrid / MailChimp or change your application to send mail via SMTP on Plesk server.

What ports does a 'System.Net.Mail.SmtpClient' need with 'SmtpClient.EnableSsl' set to true?

As the title says, what ports does an 'System::Net::Mail::SmtpClient' need with 'SmtpClient::EnableSsl' set to true?
The documentation on the EnableSsl property says the default port for an alternative connection method is 465 but doesn't mention what's used for the connection type it does support.
Edit - If it makes a difference, I'm connecting to Gmail in this instance but generic answers would be welcome.
To send mail to Gmail using System::Net::Mail::SmtpClient and SSL, you must use port 587, as documented in the GMail API.
Both ports 25 and 587 are available on GMail, but Port 587 will require a SMTP authentication before sending a mail, while port 25 won't. Given that port 25 don't require sender authentication, GMail will more agressively filter connections from ip adresses which are not proper mail servers in order to reduce spams.
The GMail API also allows use of port 465, but you can't use it with System::Net::Mail::SmtpClient, as documented by Microsoft. Port 465 is for SMTP over SSL : first establish a SSL connection, then execute the SMTP transaction. With ports 25 and 587, an unencrypted SMTP session is opened first, before switching to SSL using STARTTLS and completing the SMTP transaction. The latter is the method implemented by the .Net SMTP client.
A quick test with Wireshark suggested that the answer is port 25 by default
The client uses STARTTLS to re-use an initially unencrypted link to subsequently send encrypted data.
SMTP over SSL is not implemented in SMTPClient .NET Framework.
You must use PORT: 587.
An alternate connection method is where an SSL session is established up front before any protocol commands are sent. This connection method is sometimes called SMTP/SSL, SMTP over SSL, or SMTPS and by default uses port 465. This alternate connection method using SSL is not currently supported.
MSDN SMTPClient doc
In addition to port 25, port 587 is a common port for SMTP clients and works with SSL. You may find this answer useful.
Edit - If you're trying to connect to Gmail, see here and here.

Resources