I'm currently having some issues sending mail from my droplet. I can confirm this works in my local. I'm using the same settings except for including the name option in the transport to include my domain name. The emails are not making it to the recipient nor the spam folder.
UPDATE: Even removing the name option gives the same outcome.
This is my response
{
accepted: [ 'toemail#email.com' ],
rejected: [],
envelopeTime: 176,
messageTime: 337,
messageSize: 27416,
response: '250 2.0.0 OK <31ccdd12-a4f2-bf72-9064-b7a3a7857eb8#mydomain.com>
[Hostname=microsoft365hostname]',
envelope: { from: 'email#mydomain.com', to: [ 'toemail#email.com' ] },
messageId: '<31ccdd12-a4f2-bf72-9064-b7a3a7857eb8#mydomain.com>'
}
Here is my transport object
function getTransporter() {
return nodemailer.createTransport({
name: "mydomain.com",
host: "smtp.office365.com",
port: 587,
auth: {
user: user,
pass: pass
},
tls: true,
});
}
Here is my UFW
To Action From
-- ------ ----
22/tcp ALLOW Anywhere
80/tcp ALLOW Anywhere
443/tcp ALLOW Anywhere
27017 ALLOW //mypersonalipaddress for mongo
22/tcp (v6) ALLOW Anywhere (v6)
80/tcp (v6) ALLOW Anywhere (v6)
443/tcp (v6) ALLOW Anywhere (v6)
587 ALLOW OUT Anywhere
587 (v6) ALLOW OUT Anywhere (v6)
I can also confirm that Digital Ocean told me ports 25 and 587 are not being blocked.
If my droplet IP was blacklisted would the mail atleast make it to spam folder ? I ran a scan on my droplet IP and found there was 3 places who had it blacklisted probably to do with when I was changing my Nameservers from godaddy to Digital Ocean. Since then, I am currently using Godaddy's NS and just pointing an A record to my droplet IP.
UPDATE :
Sender: support#mydomain.org
Recipient: myemail#yahoo.com
Received -> Processed -> Not delivered
Status: Office 365 received the message that you specified, but couldn't
deliver it to the recipient (myemail#yahoo.com) due to the following
error:<br /><br /><b>Error:</b> The message was not delivered.<br /><br
/>A non-delivery report (NDR) message was sent to support#mydomain.org.
The NDR might provide more details about why the email message wasn't
delivered and how to fix the issue.
More information: <div>Ask the sender (support#mydomain.org) to follow
the instructions in the NDR to fix this issue. The NDR might also
include specific information for email admins. If the sender is unable
to fix the issue, ask them to forward you the NDR and then follow the
guidance for email admins.</div>
Date (UTC-05:00) | Event | Detail |
------------------------------------
10/31/2021, 4:16 PM | Fail | The message was not delivered.
More information
Message ID:<7e6d8c35-7824-6df7-bb08-236af8fbe9ee#mydomain.org>
Message size | From IP | To IP
28.17 KB | mydropletip | null
UPDATE:
I found the NDR emails:
Your message wasn't delivered because the recipient's email provider
rejected it.
Remote Server returned '550 5.7.708 Service unavailable. Access
denied, traffic not accepted from this IP
UPDATE: Instead of dealing with this, I decided to just utilize send grid and authorize my domain. I was able to get email working inside my droplet using their simple API. I have a feeling the droplet's IP address was blacklisted. They do try to deter people away from using droplet as mail service. I understand why now.
Related
I have to send an email from python function to multiple users with dynamic content.
I have given email details in gramex.yaml as below
email:
barcode-mail-service:
type: gmail
email: gramex.guide#gmail.com
password: alphaBetaGamma
In my python function I have implemented mail functionality as below:
def email_users(_pending_users, approval):
mailer = service.email['barcode-mail-service']
content = []
if approval == 'Approved':
content = [f"Hi {obj['user']},\n\n \
Welcome to the Service online portal!"
for obj in
_pending_users.to_dict('r')
]
else:
content = [f"Hi {obj['user']},\n\n \
Your request has been rejected by the approver!"
for obj in _pending_users.to_dict('r')
]
to_list = _pending_users['email'].tolist() #gets list of all email ids
for index in range(len(to_list)): #loops over each mail id and sends the email
mailer.mail(
to=to_list[index],
subject=f'Barcode User Access {approval}',
html=content[index]
)
When I execute the above function I get the following error:
TimeoutError: [WinError 10060] 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
How can I fix this?
This seems to be a Firewall issue. SMTP internally uses port 25 for sending email. Enable (Allow) port 25 on your system and try if that works. You would need to enable this port on the server as well during deployment.
Note: Check which port is being used for sending the email by your Email Exchange
You can check this link to enable on Windows OS
How can I use from a VM (linux) where a Java application is running a SMTP Server/relay?
For connecting to SMTP I want to use an O365 account, so configuration looks like:
host: smtp.office365.com
port: 587
TLS: true
uid: UID-O365
pwd: PWD-O365
As response I get:
An error has occurred with sending the test email:
MailException: com.sun.mail.smtp.SMTPSendFailedException:
501 5.1.7 Invalid address [AM4P190MB0211.EURP190.PROD.OUTLOOK.COM]
;
nested exception is:
com.sun.mail.smtp.SMTPSenderFailedException: 501 5.1.7 Invalid address
[AM4P190MB0211.EURP190.PROD.OUTLOOK.COM]
remark: The application that wants to connect runs on java, what is probably unimportant
The server is telling you that the address "AM4P190MB0211.EURP190.PROD.OUTLOOK.COM" that you're using in your message as a sender or recipient address is not a valid email address. It at least needs a "#" in there somewhere. You can get more detail in the JavaMail debug output.
The solution is simple: sender email address (what was not listed above) and UID must be the same
I have installed Gitlab 8.15 and Exim 4.84 on CentOS 7
Whenever Gitlab sends a message, it should come from 'gitlab#mydomain.nl' which is correctly set in config/gitlab.yml.
If I look in the log, I see the following:
2016-12-21 21:50:02 cwd=/ 6 args: /usr/sbin/sendmail -i -f gitlab#mydomain.nl -- mypersonal#gmail.com
2016-12-21 21:50:02 1cJnpq-0001ZR-NG <= git#vps.mydomain.nl U=git P=local S=3859 id=585aeafaad130_175126f0b9c43854#vps.mydomain.nl.mail T="Reset password instructions" from <git#vps.mydomain.nl> for mypersonal#gmail.com
Note that between those 2 lines, the from address changed from gitlab#mydomain.nl to git#vps.mydomain.nl which is based on user#FQDN.
My external SMTP server then does a DKIM and SPF lookup on vps.mydomain.nl, instead of mydomain.nl, which fails and the mail is rejected.
I am not sure where this change happens and how I should fix this. Is this something on Gitlab side or something on Exim side?
The relevant parts from my exim configuration:
begin routers
mysmtphost_email:
driver = manualroute
domains = ! +local_domains
ignore_target_hosts = 127.0.0.0/8
transport = mysmtphost_relay
route_list = * vps.mysmtphost.email::587
no_more
(...)
begin transports
mysmtphost_relay:
driver = smtp
port = 587
hosts_require_auth = <; $host_address
hosts_require_tls = <; $host_address
Just found out the user git was not part of the trusted_users directive in the exim.conf file. I changed it to include the user as follows:
trusted_users = mail:apache:passenger:git
I came to this conclusion since mails sent by other Rails applications running as user passenger were being sent correctly as specified by the from address. Then I noticed passenger being part of this directive and git not.
From the Exim documentation:
Trusted users are always permitted to use the -f option or a leading
“From ” line to specify the envelope sender of a message that is
passed to Exim through the local interface (see the -bm and -f options
below). See the untrusted_set_sender option for a way of permitting
non-trusted users to set envelope senders.
http://www.exim.org/exim-html-current/doc/html/spec_html/ch-the_exim_command_line.html#SECTtrustedadmin
Processes running as root or the Exim user are always trusted. Other
trusted users are defined by the trusted_users or trusted_groups
options. In the absence of -f, or if the caller is not trusted, the
sender of a local message is set to the caller’s login name at the
default qualify domain.
I've just installed git git-1.8.1.2 and gitlab gitlab_6.7.2-omnibus-1.ubuntu.12.04_amd64.deb on fresh install of Ubuntu 12.04 lts following: https://gitlab.com/gitlab-org/omnibus-gitlab/blob/master/README.md#ubuntu-12-04 and: https://www.gitlab.com/2014/03/12/packaged-gitlab-with-omnibus/
When setting up a new user in gitlab, it attempts to send out an email with temporary passwords but postfix gets an error from the relay host:
Bad sender address syntax (in reply to MAIL FROM command)
My /etc/gitlab/config/environments/production.rb looks like this
config.action_mailer.delivery_method = :smtp
config.action_mailer.perform_deliveries = true
config.action_mailer.raise_delivery_errors = true
config.action_mailer.smtp_settings = {
:address => 'mail.domain.com',
:port => 587,
:domain => 'domain.com',
:user_name => 'username#domain.com',
:password => 'password',
:authentication => 'password',
:enable_starttls_auto => true
}
I can send email via command line with postfix using I think the same relay host.
echo “This will go into the body of the mail.” | sendmail “Hello world” myemail#domain.com
What might be going wrong and where should I look?
I have also had the same problem on AWS using SES. After wasting 2 days debugging, reading docs and forums, I tried to loose the Security Group inbound rules, which were restricted only to the ports 22, 80 and 443.
Firstly I opened all inbound traffic for debug purposes. As soon as I open all ports to the world (0.0.0.0/0), the issue was gone. But this cannot stay so, then I closed all inbound ports, except 22 (SSH), 90 (HTTP), 443 (HTTPS) and additionally 25 (SMTP) to the IP of the SMTP-Server and it is still working.
So, to sum up, the SES needs to be able to communicate with the server using the SMTP port. That's why the port must be open for inbound traffic as well.
I'm trying to get the IP address of a website that does not respond to pings -- they time out.
I'm trying to do this from a C# application rather than the command entry screen in windows. I've been using the ping command which has times out on some sites so it is not useful there.
Is there another way to get this information that does not require the site to respond?
Even if the site does not respond to PINGs (ICMP not enabled on the server or filtered by firewall), the PING command should still resolve the site name into an IP address and display that IP address to you.
Check the output of a ping command on Windows (the ip address in bold):
ping wikipedia.org
Pinging wikipedia.org [208.80.152.2] with 32 bytes o
Reply from 208.80.152.2: bytes=32 time=245ms TTL=50
Reply from 208.80.152.2: bytes=32 time=235ms TTL=50
Update (due to to updated question)
If you are trying to get the IP address for DNS name from a C# application, you should use the GetHostEntry method from the Dns class: http://msdn.microsoft.com/en-us/library/ms143998.aspx .
You get IP from DNS, and need it to perform a ping, so you have it already.
$ ping google.com
PING google.com (74.125.227.51) 56(84) bytes of data.
64 bytes from 74.125.227.51: icmp_seq=0 ttl=56 time=5.80 ms
64 bytes from 74.125.227.51: icmp_seq=1 ttl=56 time=6.23 ms
The IP is shown. If you aren't getting an IP, your DNS might be down.
You can also try nslookup google.com
To get an IP address from a host name in Dns.GetHostEntry(). Pass in the host name and it will return you the IP address.
There is no reason you need to ping (on anyway contact) a site to get it's IP address. A DNS lookup will give you what you need.
You can use nslookup to resolve domain names.
nslookup google.com
The following code can be used to execute a DNS lookup for the supplied host name.
Using DNS will bypass accessing the target server. It is an independant distributed directory service that maintains hostname to IP address lookups.
The following code will give the first returned IP address for a host if a DNS entry can be resolved for the supplied host name.
public void test()
{
string hostname = "google.com";
IPAddress ipAdress;
if (TryGetIpAddress(hostname, out ipAdress))
{
Console.WriteLine("Host:'{0}', IP:{1}.", hostname, ipAdress);
}
else
{
Console.WriteLine("Host '{0}' not found.", hostname);
}
}
public bool TryGetIpAddress(string hostname, out IPAddress ipAddress)
{
const int HostNotFound = 11001;
ipAddress = null;
try
{
IPHostEntry hostEntry = Dns.GetHostEntry(hostname);
ipAddress = hostEntry.AddressList[0];
}
catch (SocketException ex)
{
if (ex.ErrorCode != HostNotFound) throw;
}
return (ipAddress != null);
}
You can use tracert and it will resolve the IP address and tell you if it can be reached or where it stops.
If site (http) is up and running then it is very well clear that the sys/network admin disabled ping and most probably trace route utility too. It is getting very common now. See here. Your alternative is to use ns lookup or WHOIS service as described here
Doing this in code you should have some function like gethostbyname().
This should be on stackoverflow.com
untested
You could host this website
http://centralops.net/co/DomainDossier.aspx
you could use import.io to make functinality with the site.
https://www.import.io/
this links could give you an insight