Store e-mail locally, Ubuntu sendmail stub for Php / ~#root -i Store e-mail locally, Ubuntu sendmail stub for Php / ~#root -i Store e-mail locally, Ubuntu sendmail stub for Php / ~#root -i Store e-mail locally, Ubuntu sendmail stub for Php / ~#root -i Store e-mail locally, Ubuntu sendmail stub for Php / ~#root -i Store e-mail locally, Ubuntu sendmail stub for Php / ~#root -i Store e-mail locally, Ubuntu sendmail stub for Php / ~#root -i Store e-mail locally, Ubuntu sendmail stub for Php / ~#root -i
  • RU
  • UA
  • EN
  • Create an online store
  • Documentation
  • Blog
    • Unix ОS
    • Php
    • MySQL
    • JavaScript
    • Package Managers
    • Docker
    • Seo
  • Auxiliary services
    • Short Links
    • Exchange views YouTube
  • Sign in
  • Create Account
  • Home
  • Unix OS
  • Store e-mail locally, Ubuntu sendmail stub for Php

Store e-mail locally, Ubuntu sendmail stub for Php

Ubuntu does not come with packages for sending emails. Consider a method that saves messages to a folder in separate files.

1. You need to create a shell script in /usr/bin/f_mail.sh :

sudo nano /usr/bin/f_mail.sh

In which we will add the code:

#!/bin/sh
prefix=" /var/www/sendmail/new "
numPath=" /var/www/sendmail "

if [ ! -f $numPath/num ]; then
echo "0" > $numPath/num
fi
num=`cat $numPath/num`
num=$(($num + 1))
echo $num > $numPath/num

name="$prefix/letter_$num.html"
while read line
do
echo $line >> $name
done
chmod 777 $name
/bin/true

/var/www/sendmail/new - the path where files with emails will be saved.

/var/www/sendmail - shared folder for the script.

2. Grant rights to the script (perhaps not for everyone this is required):

sudo chown root:root /usr/bin/f_mail.sh

sudo chmod 755 /usr/bin/f_mail.sh

3. Let's create the folder structure required for work:

sudo mkdir /var/www/sendmail/new && cd /var/www/sendmail/new && sudo mkdir cur && sudo mkdir new && sudo mkdir tmp && sudo chmod -R 777 /var/www/sendmail/new

4. Recipe in php.ini :

v5.6 :

/etc/php5/apache2/php.ini
/etc/php5/cli/php.ini
/etc/php5/cgi/php.ini

v7.2 :

/etc/php/7.2/apache2/php.ini
/etc/php/7.2/cli/php.ini
/etc/php/7.2/cgi/php.ini

In the required version, in the php.ini files, add the code to the end or find the line ;sendmail_path and replace it with:

sendmail_path = /usr/bin/f_mail.sh

30 December 19
960
2

Comments

alex

04 July 2022 08:21
Сделал все так как написано в статье, не работает.
0

root-i

04 July 2022 08:57
alex, я вижу 2 причины почему так может быть. Не в том php.ini прописан sendmail_path или вы используете для отправки не протокол "sendmail" а "mail". Но в любом случае могу уже не помнить. Напишите в какой-то из контактов, посмотрим, а потом я тут это опишу.
0
Name
E-mail
Rating
Review

Other articles from the category

28 September 2022

Configuration file (php.ini) when running Cron (cli) changing parameters (memory_limit) on hosting

Let's consider the possibility of changing the parameters of the configuration file (php.ini) on a hosting that does not have the ability to configure the Cron scheduler (cli) from the panel.

12 August 2022

Ubuntu Apache 2.4 Bad Request Size of a request header field exceeds server limit

Configuring Apache for high volume Cookies. Let's analyze the error "Bad Request. Your browser sent a request that this server could not understand. Size of a request header field exceeds server limit." and options to configure the server.

26 May 2022

Ubuntu black screen after driver installation on Nvidia 630M

Let's try to cure the black screen when booting Ubuntu after installing proprietary nvidia-340 driver on Nvidia 630M laptop.

06 January 2022

USB not working after Ubuntu 18.04 update on laptop

When USB 2.0-3.0 stopped working after updating Ubuntu on a laptop.

18 December 2021

Running Skype (skypeforlinux) in multiple Ubuntu windows

Ability to run Skype in multiple windows. Installed on Ubuntu skypeforlinux run in 2 windows.

23 March 2020

Disabling bluetooth speakers, dos attack on bluetooth in Linux

Let's consider one of the ways to dos-attack on bluetooth through the basic l2ping tools in linux. Let's analyze a simple python script.

26 June 2019

Ubuntu 18.04 initramfs error

Let's analyze one of the reasons for the initramfs error when starting Linux Ubuntu 18.04. Let's try a system restore. fsck exited with status code 4.

31 March 2019

Npm : Depends node-gyp but won`t install Ubuntu 18.04

Unsatisfied links when installing npm, after installing node.js. Consider an alternative installation option.

Categories

  • Unix OS
  • Php
  • MySQL
  • JavaScript
  • Package Managers
  • Docker
  • Seo

Latest comments

Добрый день, Сергей. Я на более новых версиях блют...
root-i
23.02.23
Пробовал на transmart колонке. Ничего из перечисле...
Сергей
20.02.23
HenryMit, может быть
root-i
07.02.23
Неофрейдизм — это… Определение, принципы, представ...
HenryMit
07.02.23

I share information in which I needed help and spent a lot of time figuring it out. If the information helped at least one person, then this site was not created in vain.

Thank you for the continuation of the site:
Contacts

Telegram Viber Mail

Search for articles

  • Sign in
  • Create Account

Powered by chmod -R