Need help setup windows server 2008 SMTP server - smtp

I am trying to setup windows server 2008 smtp server to relay emails to gmail smtp. Everything appears to be setup but it is not sending emails. Could you please help me figure out whats wrong.
Below is the setup:
Windows server 2008 with SMTP server
feature installed. Need SMTP server
to forward all messages to gmail smtp
server to send.
I have google apps setup for my
domain, also I can send emails
throught my test app using
gmail smtp.
SMTP Server Configuration: By default has default smtp server virtual directory.
In Properties of that virtual smtp server changed following.
Fully qualified domain name = mydomain.com
smart host = smtp.gmail.com
TCP Port = 587
Out Bound Security = Basic Authentication(my username password for google apps email account)
In domains list under virtual smtp server. I have one default domain that's server dns. I added another one for my domain name.
With above setup i am trying to redirect all email to gmail smtp.
I tested connection to smtp.gmail.com from server on port 587 through telnet and it works.
I am trying to use above server from my web application also by just dropping emails in pickup directory. It get's picked up and also accepts request form web application but never sends an email.
I can see that it adds those emails in queue folder but it stays there forever.
When i try to send emails from web app to above server it rejects if To address is other than my domain.(Am i missing something in list of domains)

Thanks for all answers, finally found solution there is a property for maximum sessions which value was 0 by default. Changed it to 100 and it send all pending emails immediately.

Possible reasons are that some SMTP servers block the outgoing messages if there domain name mismatch, possible to prevent spam mails from being sent. So for example, I will not be able to send my email with an address abc#mydomain.com from my domain yourdomain.com.
Hope that helps.

Ensure your sending domain is the same as the google apps domain
Ensure your sending address is a real address and not just an alias
IIRC you need to use STARTTLS (SSL) not basic authentication

This souds like a DNS issue. Check your /badmail directory. It will have .bad and .bdp files in there. You can open these in notepad (there will be some binary in there).
However, it may point to the possible problem.
You may also want to try and enable logging on the SMTP service. There may be something in there.

Related

Cannot send email using SMTP server through Office 365 with ADFS

I am trying to send an email using the smtp.office365.com server. It always return the same error:
5.7.57 Client not authenticated to send mail.
As far as I know, the problem is related with the fact that I'm working with ADFS. So I have previously federated my domain to work with Office 365. When I try to log in to Office, I'm redirected to the login page of my platform, which is fine.
Is there a way to send email using the Office smtp server when working with ADFS?
Not to my knowledge, you need to change the primary username to use your tenant domain rather than your federated domain. Then you'll be able to log in without ADFS.
We configured a single account for SMTP with just an Exchange Plan 1 license, and then set up internal SMTP relays using that account to transmit to O365. We then limit connections on that account to only known locations. Then we add SendAs permissions for that account to all the DLs/mailboxes that we need to send email from.

Failure Sending Mail using GSuite SMTP

I have a very curious issue with an application. When debugging locally, I can send emails just fine using a client's G Suite email credentials:
<smtp deliveryMethod="Network" from="client#customdomain.com">
<network defaultCredentials="false"
host="smtp.gmail.com"
port="587"
userName="client#customdomail.com"
password="supersecret"
enableSsl="true" />
</smtp>
Now, it's very important to note that the application will send just fine with the credentials when running on localhost using Visual Studio. However, when deploying to LIVE and using the exact same credentials, the application refuses to send and I only get the canned response back saying "Failure Sending mail".
I have enabled "less secure applications" in the settings and have verified the "suspicious activity" from the server's IP address. I can also log in to the Gmail account from the server using RDP and opening Firefox to go to Gmail.com.
No firewall rule has been set to block SMTP or anything on port 587.
UPDATE: the materialized error message is
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 74.125.192.108:587
74.125.192.108 being smtp.gmail.com's IP Address (or one of them, at least)
UPDATE 2: I can also not get Thunderbird on the remote server to send an email using the supplied credentials, however it can connect via IMAP and download the contents of the inbox just fine.
Well in this very specific case, it was the fault of the Amazon infrastructure this application ran on. Either amazon themselves, or the reseller changed a policy that ended up blocking communications on ports 465, 587 and 993 (and probably others too).
The "solution" was to nag them to sort it out.

Using domain mail server for sendmail

The piece of php script is:
$sendmail=1;
$sendmail_path='/path/to/sendmail';
$smtp_server='localhost';
My webhost want me to use my domain smtp mail server mail.xxxxx.net instead of "localhost" otherwise sendmail is blocked.
I don't know how to reset the script.
Please help me
Thanks
One of the settings that you tried
<?php
$smtp_server='mail.telugugreetings.net';
is actually a correct setting, as indicated by its error message:
Additional errors: 550 Access denied - Invalid HELO name (See RFC2821 4.1.1.1)
This is an SMTP error, so you have successfully connected to your SMTP server. This error indicates a completely different problem:
4.1.1.1 Extended HELLO (EHLO) or HELLO (HELO)
These commands are used to identify the SMTP client to the SMTP server. The argument field contains the fully-qualified domain name of the SMTP client if one is available. In situations in which the SMTP client system does not have a meaningful domain name (e.g., when its address is dynamically allocated and no reverse mapping record is available), the client SHOULD send an address literal (see section 4.1.3), optionally followed by information that will help to identify the client system. y The SMTP server identifies itself to the SMTP client in the connection greeting reply and in the response to this command.
Make sure that you are setting the "From" field properly. It should probably be something ending in #telugugreetings.net. Without knowing more about your mail server and your PHP code, including any libraries you may be using to send mail, I can't be more specific.
You might need to contact your hosting provider again to ask about this new error message.
The PHP manual's mail() Runtime configuration says:
Used under Windows only: host name or IP address of the SMTP server PHP should use for mail sent with the mail() function.
Click Here for PHP Mail Runtime configuration
Is this on you local Windows machine?
Are you hosting on a Windows machine?
If not Windows the SMTP directive is ignored.
If you have a Windows machine:
The PHP setting for SMPT is a "PHP_INI_ALL, Entry can be set anywhere"
Which mean this directive can be set Runtime, in:
php.ini, .htaccess, httpd.conf or .user.ini
Get you SMPT Configurations Setting:
echo ini_get('SMTP');
To Set you SMTP
ini_set ('SMTP', $SMPTServer)
Where $SMPTServer is the host name or IP address of the SMTP server PHP should use for mail sent.

can php send email without mail server installed in server?

I know we can send email from php using smtp servers on different hosts or if there is local smtp server installed. What I want to know is can php send email without any local or remote smtp servers? I have heard about sendmail program but can it function without any mail server installed in the server?
At some point you have to talk to a SMTP server. Sending via a SMTP server on the local host is the cleanest option and the most likely to succeed at getting through spam filters.
What a mail server does is quite complex. Let's take your average e-mail as it arrives from your e-mail client to your e-mail server with an outbound host as the destination:
The server checks your user account and makes sure it is valid.
The e-mail goes into a queue either separately for each recipient or as one message (depends on the server).
The server finds the e-mail in the queue and processes each recipient address. This requires a DNS lookup for a MX record for each target domain.
The e-mail server connects to the address specified by the MX record and delivers the e-mail to it as one does over SMTP.
On success, the e-mail is removed from the queue. On failure, the e-mail may remain in the queue and the server will try again later (exponential backoff - see greylisting) or be put in the mail queue to be returned to you when you check your e-mail via POP3 later.
The next e-mail server in the queue then repeats the above until the final server receives the e-mail and sits in the recipient's mailbox.
Doing that within PHP is possible, but I don't recommend it. MX record lookup can be tricky because people do all sorts of non-compliant things that mail servers tolerate. Plus, your script might time out while attempting to connect directly to the target SMTP server. Some servers are also configured to "greylist" e-mail, which means the e-mail will initially be rejected but would be accepted later (e.g. 30 minutes is not unusual). The average PHP script won't be able to handle that scenario.

Setting up SMTP mail server. Done with installing SMTP. Now what?

I want to host my own mailserver using my own domain. So far I can see that SMTP needs to be installed and the DNS record has to be modified to point to my mailserver. So far so good. But what about mailaccounts? How do I create mail#mydomain.com with username and password so I can start receiving emails in outlook?
What more does it take to be able to receive mails in outlook now that im done with installing SMTP on my server?
Installing just the smtp service isn't going to get you what you need. In order for users to get their mail you'd need a pop server, or an IMAP server or and exchange server.
What you need is a seperate mail hosting package. Something like Imail from Ipswitch. Or exchange from Microsoft.
SMTP is simply a mail transfer mechanism, it will receive emails for remote SMTP servers and then try an deliver them. It does not handle mailboxes or email accounts, for this you will need a POP3, IMAP or Exchange server.