Using domain mail server for sendmail - smtp

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.

Related

Google SMTP returns required authentication but it's done as an app password

I am setting up SMTP service on Airflow 2.1.2.
I get this error which is quite obvious:
smtplib.SMTPSenderRefused: (530, b'5.7.0 Authentication Required. Learn more at\n5.7.0 https://support.google.com/mail/?p=WantAuthError w5sm3433302wra.87 - gsmtp'
But authentication is done, i am using an email that has 2 steps authentication, so I created an app password and I recognized the activity in google account security tab..
My setup is:
AIRFLOW__EMAIL__EMAIL_BACKEND airflow.utils.email.send_email_smtp
AIRFLOW__SMTP__SMTP_HOST smtp.gmail.com
AIRFLOW__SMTP__SMTP_MAIL_FROM my email
AIRFLOW__SMTP__SMTP_PASSWORD my app pwd of 16 chars
AIRFLOW__SMTP__SMTP_PORT 587
AIRFLOW__SMTP__SMTP_SSL False
AIRFLOW__SMTP__SMTP_STARTTLS True
AIRFLOW__SMTP__SMTP_USER my email
I checked and there is no extra space or something like that neither in pwd or email.
Why is it returning required authentication when authentication is really done?
Not sure why it is not working. But do you see:
Fetching SMTP credentials from configuration variables will be deprecated in a future warning? You should if your environment variables will be used.
If you do not see it, then you likely have smtp_default connection in the Connection database.
In Airflow 2 the authentication for SMTP has been brought to the same level as other connections and rather than passing user/password via environment variable, they should be configured as login/password in the 'smtp_default' connection.
The variables should still work as fallback, but if you already have smtp_default connection created and has some login/password (even empty) configured, those will be used instead of the ENV vars.
In your case likely the solution will be to set login/password in the connection.

OJS 3.0.1 is not sending any emails

I have a new installation of OJS 3.0.1. I am new to OJS so I apologize if my question is simple. I log in as the manager and create a journal. I tell it to send email to my address but I never receive it. . When I try to send from OJS there is nothing in the maillog . in OJS in the classes/mail folder there are only 1 php files. Is that correct.
Also, is there an easier way to test sending mail from OJS
Please see the documentation:
3) Emails sent out by the system are never received.
A: By default, OJS sends mail through PHP's built-in mail() facility.
On Windows PHP needs to be configured to send email through a SMTP
server (running either on the same machine or on another machine).
On other platforms such as Linux and Mac OS X, PHP will sent mail using the local sendmail client, so a local MTA such as
Sendmail or Postfix must be running and configured to allow
outgoing mail.
See http://www.php.net/mail for more details on configuring PHP's mail functionality.
OJS can also be configured to use an SMTP server as specified in config.inc.php, either with or without authentication.
There are many ways to configure email for OJS. There are advantages and disadvantages all around. Using Gmail for SMTP is simple to set up, but it does not give you the ability to direct emails to individual associate editors. If you want fine grained control, you need to run your own mail server, and that takes some setting up. Also, with your own mail server, spam filtering becomes a problem. For our installation, we had to send email from OJS to our own email server (same domain) and then forward to external addresses. If we sent directly from OJS to external addresses, spam filters would block the email b/c OJS wants to impersonate your email address while sending it from another domain (you solve this by creating an email address in the same domain as OJS so the email headers aren't spoofed this way).
You can see specific examples of email set ups here. Reviewing these might answer your question or help you ask a more specific one.
There are 2 easy ways to setup Open Journal System (OJS) email
config.inc.php
PHPMailer.php
config.inc.php
Open config.inc.php (public_html/config.inc.php), uncomment and configure the following lines
smtp = On
smtp_server = mail.domain.com
smtp_port = 465
smtp_auth = ssl
smtp_username = info#domain.com (your email)
smtp_password = *********** (your password)
you can confirm smtp_server and smtp_port through cpanel
enter image description here
PHPMailer.php
Open PHPMailer.php (public_html/lib/pkp/lib/vendor/phpmailer/phpmailer/src/PHPMailer.php) and configure the following
public $From = 'info#domain.com';
public $FromName = 'User';
public $Host = 'ssl://smtp.domain.com';
public $Port = 465;
public $Username = 'info#domain.com';
public $Password = '**************';
public $AuthType = 'ssl';
In New Version of OJS-3.2.0-1 has no setting of SMTP and PHPMailer Setting. Many people worried about email notification when I debug the issue I found that no SMTP Setting & PHPMailer.
First of all, User should check localhost Connecting with XAMPP Server. If the server has successfully sent a mail message it means localhost is working. Now you should check simple code of PHPMailer to check the Connectivity with XAMPP while PHPMailer is working

Greenmail standalone smtp server email error

I started a standalone Greenmail SMTP server with the following configurations in root mode so that i can use 25 port,
java -Dgreenmail.setup.all -Dgreenmail.users=test1:pwd1 -Dgreenmail.hostname=10.107.45.11 -jar greenmail-standalone.jar
I am able to connect to this mail server on port 25 and send an email (from telnet as well as a java program) without any error.
But when i try to find the email I sent (using a java program), it comes out as 0 always.
Received emails is always zero.
I am not sure if Greenmail can be used in this manner as a standalone server.
Can anyone please help?
After much of trying, I understand that the "INBOX" from which we need to fetch the messages is tied to the username and the following invocation of standalone greenmail jar gives you the emails that you expect to receive.
We need to pass the username, password and To-email address for it work seamlessly.
Also, specifying the ports separately makes it much easier to customize.
java -Dgreenmail.smtp.port=25 -Dgreenmail.imap.port=143 -Dgreenmail.users=test1:pwd1#10.107.45.11 -Dgreenmail.hostname=10.107.45.11 -jar greenmail-standalone-1.5.3.jar

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.

Need help setup windows server 2008 SMTP server

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.