Can't force phpMailer to send mail from nginx server - xampp

I use actual version of phpMailer (downloaded yesterday from github). It sends mails from my local computer (Win10, xampp 7.4.3) and can't send it from server (centOs7, nginx, php7). Both computers in one LAN behind the same firewall.
I suspect php.ini configuration, but what should be configured exactly?
Thanks for any help.

The solution:
# sudo setsebool -P httpd_can_sendmail 1
The tracking of my search:
Switch on the DebugMode in phpMailer (for each new PHPMailer object):
$mail = new PHPMailer\PHPMailer\PHPMailer();
$mail->SMTPDebug = 4;
Checking out 'Console' tab output in Chrome DevTools:
SMTP ERROR: Failed to connect to server: Permission denied (13)
Googling for the error text - https://stackoverflow.com/a/50302148/9751142
Hope this helps anybody else.

Related

Laravel Dusk Testing has an error on the server Curl error thrown for http POST to /session with params

I would like to ask me to try the following instructions on Plesk Server:
php artisan dusk
The following error will occur:
1) Tests\Browser\ExampleTest::testBasicExample
Facebook\WebDriver\Exception\WebDriverCurlException: Curl error thrown for http POST to /session with params: {"desiredCapabilities":{"browserName":"chrome","platform":"ANY","chromeOptions":{"binary" :".\/vendor\/laravel\/dusk\/bin\/chromedriver-linux","args":["--disable-gpu","--headless","--no-sandbox"," --verbose","--window-size=1024,768"]}}}
Failed connect to localhost:9515; Connection refused
/var/www/vhosts/fanswoo.com/fanswoo-framework/vendor/facebook/webdriver/lib/Remote/HttpCommandExecutor.php:292
/var/www/vhosts/fanswoo.com/fanswoo-framework/vendor/facebook/webdriver/lib/Remote/RemoteWebDriver.php:126
/var/www/vhosts/fanswoo.com/fanswoo-framework/tests/DuskTestCase.php:43
/var/www/vhosts/fanswoo.com/fanswoo-framework/vendor/laravel/dusk/src/Concerns/ProvidesBrowser.php:192
/var/www/vhosts/fanswoo.com/fanswoo-framework/vendor/laravel/framework/src/Illuminate/Support/helpers.php:754
/var/www/vhosts/fanswoo.com/fanswoo-framework/vendor/laravel/dusk/src/Concerns/ProvidesBrowser.php: 193
/var/www/vhosts/fanswoo.com/fanswoo-framework/vendor/laravel/dusk/src/Concerns/ProvidesBrowser.php:93
/var/www/vhosts/fanswoo.com/fanswoo-framework/vendor/laravel/dusk/src/Concerns/ProvidesBrowser.php:64
/var/www/vhosts/fanswoo.com/fanswoo-framework/tests/Browser/ExampleTest.php:22
I suspected that the Chrome Driver could not be executed, so I used the following command to detect:
./vendor/laravel/dusk/bin/chromedriver-linux
The return is as follows:
Starting ChromeDriver 2.43.600233 (523efee95e3d68b8719b3a1c83051aa63aa6b10d) on port 9515
Only local connections are allowed.
Indicates that ChromeDriver can be opened normally.
The code can also be detected on the local computer. Only when the dusk command is executed in Plesk Server will the error occur. May I ask what God should I continue to do or what to modify? Thank you!
The server specifications are as follows:
CentOS 7.5
PHP 7.1
DB SQLite3
Laravel Version 5.7
ChromeDriver Version 69
If you able to start chromedriver successfully, now try to access the below url with respective port.
http://localhost:{port}/status
For e.g., in above message, the server started on port 9515. Access the url in browser, http://localhost:9515/status
You should get above message indicating server is accessible with hostname as localhost
If your are not able access, then fix the specific issue

Untrusted Host in symfony call

I installed a symfony application in a centos server that it is behind a proxy and when I try to reach it from an external pc I receive this error: Untrusted Host "192.168.43.218" and below that in public/index.php (line 37) $response = $kernel->handle($request);
I tried to follow this guide but nothing happens...Also my index.php is different than the one in the example. How can I solve this?
Solved, I had to insert in framework.yaml the trusted_hosts: ['192.168.43.218', '192.168.43.218'] command (the ip of the server)

Unable to Retrieve Directory Using ProFTPD(WHM)

Well, after looking for many solutions. I came here now.
I am setting up WHM/cPanel for hosting website. Everything was going smooth but I am stuck on FTP connection (Server sent passive reply with unroutable address. Using server address instead.)
Server Details:
CentOS Linux release 7.2.1511 (Core)
WHM/cPanel Version 11.58.0.13
FTP Server: PureFTPD
Acutal error while connecting
To fix this issue and get FTP working you need to open up more numbered ports so FTP can connect. I assume you are using CSF.
Login to WHM then go to CSF >> Firewall Configuration >>
allow TCP_In 30000:50000 and TCP_Out 30000:50000
Once you made the changes Restart the firewall
Now you need to make changes in FTP config file to use these ports, you will find this file to this location /etc/pure-ftpd.conf
Now you will see a line as follows and you will need to uncomment it
# Port range for passive connections replies. - for firewalling.
PassivePortRange 30000 50000
Restart FTP Service and should work.

How to setup FTP on xampp

i want to make a server using xampp. i have already installed xampp and setting port 8080. php and mysql work fine but i can't access ftp from internet. Can you please suggest way how can I do this?
XAMPP comes preloaded with the FileZilla FTP server. Here is how to setup the service, and create an account.
Enable the FileZilla FTP Service through the XAMPP Control Panel to make it startup automatically (check the checkbox next to filezilla to install the service). Then manually start the service.
Create an ftp account through the FileZilla Server Interface (its the essentially the filezilla control panel). There is a link to it Start Menu in XAMPP folder. Then go to Users->Add User->Stuff->Done.
Try connecting to the server (localhost, port 21).
XAMPP for linux and mac comes with ProFTPD. Make sure to start the service from XAMPP control panel -> manage servers.
Further complete instructions can be found at localhost XAMPP dashboard -> How-to guides -> Configure FTP Access. I have pasted them below :
Open a new Linux terminal and ensure you are logged in as root.
Create a new group named ftp. This group will contain those user accounts allowed to upload files via FTP.
groupadd ftp
Add your account (in this example, susan) to the new group. Add other users if needed.
usermod -a -G ftp susan
Change the ownership and permissions of the htdocs/ subdirectory of the XAMPP installation directory (typically, /opt/lampp) so that it is writable by the the new ftp group.
cd /opt/lampp
chown root.ftp htdocs
chmod 775 htdocs
Ensure that proFTPD is running in the XAMPP control panel.
You can now transfer files to the XAMPP server using the steps below:
Start an FTP client like winSCP or FileZilla and enter connection details as below.
If you’re connecting to the server from the same system, use
"127.0.0.1" as the host address. If you’re connecting from a different
system, use the network hostname or IP address of the XAMPP server.
Use "21" as the port.
Enter your Linux username and password as your FTP credentials.
Your FTP client should now connect to the server and enter the /opt/lampp/htdocs/ directory, which is the default Web server document root.
Transfer the file from your home directory to the server using normal FTP transfer conventions. If you’re using a graphical FTP client, you can usually drag and drop the file from one directory to the other. If you’re using a command-line FTP client, you can use the FTP PUT command.
Once the file is successfully transferred, you should be able to see it in action.
I launched ubuntu Xampp server on AWS amazon.
And met the same problem with FTP, even though add user to group ftp SFTP and set permissions, owner group of htdocs folder.
Finally find the reason in inbound rules in security group, added All TCP, 0 - 65535 rule(0.0.0.0/0,::/0) , then working right!
On XAMPP click "Start" and after "Admin".
Login to localhost (127.0.0.1) without password, with second port, not with 21.
Add users and passwords, change your settings. Quit.

How to solve error message about squirrel mail (ERROR: Connection dropped by IMAP)

I was setup squirrel mail in centos 6.4
and, i was installed imap(dovecot), squirrelmail, sendmail completely.
and open, port 110, 143, 25.
and, setting a squirrelmail about imap (through ./conf.pl)
and, i accessed a squirrel mail cite. ( domain/src/configtest.php).
... you can read below text.
SquirrelMail configtest
This script will try to check some aspects of your SquirrelMail configuration
and point you to errors whereever it can find them. You need to go run conf.pl
in the config/ directory first before you run this script.
SquirrelMail version:1.4.22-3.el6
Config file version:1.4.0
Config file last modified:22 June 2013 00:53:13
Checking PHP configuration...
PHP version 5.3.3 OK.
Running as N/A(N/A) / N/A(N/A)
display_errors:
error_reporting: 22527
variables_order OK: GPCS.
PHP extensions OK. Dynamic loading is disabled.
Checking paths...
Data dir OK.
Attachment dir OK.
Plugins OK.
Themes OK.
Default language OK.
Base URL detected as: http://mtest.gbs-korea.com/src (location base autodetected)
Checking outgoing mail service....
sendmail OK
Checking IMAP service....
IMAP server ready (* OK [CAPABILITY IMAP4rev1 LITERAL+ SASL-IR LOGIN-REFERRALS ID ENABLE IDLE STARTTLS AUTH=PLAIN] Dovecot ready.)
Capabilities: * CAPABILITY IMAP4rev1 LITERAL+ SASL-IR LOGIN-REFERRALS ID ENABLE IDLE STARTTLS AUTH=PLAIN
Checking internationalization (i18n) settings...
gettext - Gettext functions are available. On some systems you must have appropriate system locales compiled.
mbstring - Mbstring functions are available.
recode - Recode functions are unavailable.
iconv - Iconv functions are available.
timezone - Webmail users can change their time zone settings.
Checking database functions...
not using database functionality.
Congratulations, your SquirrelMail setup looks fine to me!
Login now
...
but, i can't access my account because below message.
ERROR:
ERROR: Connection dropped by IMAP server.
....
how to solve it problem?
To resolve such an issue:
Edit the file /etc/dovecot/dovecot.conf and add the following line in the IMAP section:
protocol imap {
mail_location = mbox:~/mail:INBOX=/var/mail/%u
}
Restart dovecot:
/etc/init.d/dovecot restart
That’s it.
For Centos 6.6 and Centos 7
nano /etc/postfix/main.cf
change parameter to :
home_mailbox = mail/
nano /etc/dovecot/conf.d/10-mail.conf
set parameter to:
mail_location = maildir:~/mail
sudo service postfix restart
sudo service dovecot restart
Did you tried telnet to the server to port 143
try "telnet hostname _or_IP 143"
Make sure that the entered E-mail account mailbox is exists in the server. Also make sure that the its MX is local domain if the domain points to the server in which you have installed squirrel mail. In case if its using remote MX then you need to use a domain that is having MX on the current server.
dig +trace domain_name MX will show you the domain's MX record.
mailbox needs to exist, e.g. do it like this:
-first install mailx
-then issue following command (replace 'mail#example.org' with the email-address you use to log in to squirrelmail)
# mailx mail#example.org
-then type subject of your choice and hit enter
-then type text of your choice and hit enter
-finally hit ctrl+d
now it should be possible to log in

Resources