diff --git a/assets/css/src/settings.scss b/assets/css/src/settings.scss
index 151561f43e..b977a7a884 100644
--- a/assets/css/src/settings.scss
+++ b/assets/css/src/settings.scss
@@ -43,6 +43,10 @@
margin: 0px 3px;
font-weight: bold;
}
+
+ .mailpoet_emails_per_second_warning {
+ color: #d54e21;
+ }
}
.mailpoet_woocommerce_editor_button {
diff --git a/assets/js/src/settings/pages/send_with/other/other_sending_methods.tsx b/assets/js/src/settings/pages/send_with/other/other_sending_methods.tsx
index 6bc0439166..0d71996688 100644
--- a/assets/js/src/settings/pages/send_with/other/other_sending_methods.tsx
+++ b/assets/js/src/settings/pages/send_with/other/other_sending_methods.tsx
@@ -1,14 +1,17 @@
import React from 'react';
+import { useSetting } from 'settings/store/hooks';
import SendingMethod from './sending_method';
import SPF from './spf';
import TestSending from './test_sending';
import ActivateOrCancel from './activate_or_cancel';
+import PHPMailFields from './php_mail_fields';
export default function OtherSendingMethods() {
+ const [method] = useSetting('mta', 'method');
return (
-
+ {method === 'PHPMail' &&
}
diff --git a/assets/js/src/settings/pages/send_with/other/php_mail_fields.tsx b/assets/js/src/settings/pages/send_with/other/php_mail_fields.tsx
new file mode 100644
index 0000000000..548390e3a2
--- /dev/null
+++ b/assets/js/src/settings/pages/send_with/other/php_mail_fields.tsx
@@ -0,0 +1,135 @@
+import React from 'react';
+import { Label, Inputs } from 'settings/components';
+import { t, onChange } from 'common/functions';
+import { useSetting } from 'settings/store/hooks';
+import SendingFrequency from './sending_frequency';
+
+export default function PHPMailFields() {
+ const [hostName, setHostName] = useSetting('web_host');
+ const host = hosts[hostName];
+ return (
+ <>
+
+
+
+
+
+ >
+ );
+}
+
+const hosts = {
+ manual: {
+ name: 'manual', label: t('notListed'), emails: '25', interval: '5',
+ },
+ '1and1': {
+ name: '1and1', label: '1and1', emails: '30', interval: '5',
+ },
+ bluehost: {
+ name: 'bluehost', label: 'BlueHost', emails: '70', interval: '30',
+ },
+ df: {
+ name: 'df', label: 'Df.eu', emails: '115', interval: '15',
+ },
+ dreamhost: {
+ name: 'dreamhost', label: 'DreamHost', emails: '25', interval: '15',
+ },
+ free: {
+ name: 'free', label: 'Free.fr', emails: '18', interval: '15',
+ },
+ froghost: {
+ name: 'froghost', label: 'FrogHost.com', emails: '490', interval: '30',
+ },
+ godaddy: {
+ name: 'godaddy', label: 'GoDaddy', emails: '5', interval: '30',
+ },
+ goneo: {
+ name: 'goneo', label: 'Goneo', emails: '60', interval: '15',
+ },
+ googleapps: {
+ name: 'googleapps', label: 'Google Apps', emails: '20', interval: '60',
+ },
+ greengeeks: {
+ name: 'greengeeks', label: 'GreenGeeks', emails: '45', interval: '30',
+ },
+ hawkhost: {
+ name: 'hawkhost', label: 'Hawkhost.com', emails: '500', interval: '15',
+ },
+ hivetec: {
+ name: 'hivetec', label: 'Hivetec', emails: '20', interval: '15',
+ },
+ hostgator: {
+ name: 'hostgator', label: 'Host Gator', emails: '115', interval: '15',
+ },
+ hosting2go: {
+ name: 'hosting2go', label: 'Hosting 2GO', emails: '45', interval: '15',
+ },
+ hostmonster: {
+ name: 'hostmonster', label: 'Host Monster', emails: '115', interval: '15',
+ },
+ infomaniak: {
+ name: 'infomaniak', label: 'Infomaniak', emails: '20', interval: '15',
+ },
+ justhost: {
+ name: 'justhost', label: 'JustHost', emails: '70', interval: '30',
+ },
+ laughingsquid: {
+ name: 'laughingsquid', label: 'Laughing Squid', emails: '20', interval: '15',
+ },
+ lunarpages: {
+ name: 'lunarpages', label: 'Lunarpages', emails: '19', interval: '15',
+ },
+ mediatemple: {
+ name: 'mediatemple', label: 'Media Temple', emails: '115', interval: '15',
+ },
+ netfirms: {
+ name: 'netfirms', label: 'Netfirms', emails: '200', interval: '60',
+ },
+ netissime: {
+ name: 'netissime', label: 'Netissime', emails: '100', interval: '15',
+ },
+ one: {
+ name: 'one', label: 'One.com', emails: '100', interval: '15',
+ },
+ ovh: {
+ name: 'ovh', label: 'OVH', emails: '50', interval: '15',
+ },
+ phpnet: {
+ name: 'phpnet', label: 'PHPNet', emails: '15', interval: '15',
+ },
+ planethoster: {
+ name: 'planethoster', label: 'PlanetHoster', emails: '90', interval: '30',
+ },
+ rochen: {
+ name: 'rochen', label: 'Rochen', emails: '40', interval: '15',
+ },
+ site5: {
+ name: 'site5', label: 'Site5', emails: '40', interval: '15',
+ },
+ siteground: {
+ name: 'siteground', label: 'Siteground', emails: '95', interval: '15',
+ },
+ synthesis: {
+ name: 'synthesis', label: 'Synthesis', emails: '250', interval: '15',
+ },
+ techark: {
+ name: 'techark', label: 'Techark', emails: '60', interval: '15',
+ },
+ vexxhost: {
+ name: 'vexxhost', label: 'Vexxhost', emails: '60', interval: '15',
+ },
+ vps: {
+ name: 'vps', label: 'VPS.net', emails: '90', interval: '30',
+ },
+ webcity: {
+ name: 'webcity', label: 'Webcity', emails: '19', interval: '15',
+ },
+ westhost: {
+ name: 'westhost', label: 'Westhost', emails: '225', interval: '15',
+ },
+ wpwebhost: {
+ name: 'wpwebhost', label: 'Wpwebhost.com', emails: '95', interval: '30',
+ },
+};
diff --git a/assets/js/src/settings/pages/send_with/other/sending_frequency.tsx b/assets/js/src/settings/pages/send_with/other/sending_frequency.tsx
new file mode 100644
index 0000000000..42dd1885ca
--- /dev/null
+++ b/assets/js/src/settings/pages/send_with/other/sending_frequency.tsx
@@ -0,0 +1,114 @@
+import React from 'react';
+import ReactStringReplace from 'react-string-replace';
+
+import { Label, Inputs } from 'settings/components';
+import { t, onChange } from 'common/functions';
+import { useSetting } from 'settings/store/hooks';
+
+const MINUTES_PER_DAY = 1440;
+const SECONDS_PER_DAY = 86400;
+
+type Props = {
+ recommendedEmails: string
+ recommendedInterval: string
+}
+export default function SendingFrequency({ recommendedEmails, recommendedInterval }: Props) {
+ const [frequency, setFrequency] = useSetting('mailpoet_sending_frequency');
+ const [frequencyEmails, setFrequencyEmails] = useSetting('mta', 'frequency', 'emails');
+ const [frequencyInterval, setFrequencyInterval] = useSetting('mta', 'frequency', 'interval');
+ React.useEffect(() => {
+ if (frequency === 'auto') {
+ setFrequencyEmails(recommendedEmails);
+ setFrequencyInterval(recommendedInterval);
+ }
+ }, [frequency, recommendedEmails, recommendedInterval, setFrequencyEmails, setFrequencyInterval]);
+
+ const dailyEmails = Math.floor(
+ (MINUTES_PER_DAY * parseInt(frequencyEmails, 10)) / parseInt(frequencyInterval, 10)
+ );
+ const emailsPerSecond = Math.floor((dailyEmails / SECONDS_PER_DAY) * 10) / 10;
+
+ return (
+ <>
+
+
+
+ {frequency === 'manual' && (
+ <>
+
+
+ {' '}
+ {t('emails')}
+
+ >
+ )}
+ {frequency === 'auto' && (
+
+ {t('xEmails').replace('%1$s', frequencyEmails)}
+ {' '}
+ {formatInterval(frequencyInterval)}
+ {'. '}
+
+ )}
+
+ {ReactStringReplace(
+ t('thatsXEmailsPerDay').replace('%1$s', dailyEmails.toLocaleString()),
+ /(.*?)<\/strong>/g,
+ (match, i) => {match}
+ )}
+
+
+ {emailsPerSecond > 1 && (
+ <>
+
+
+ {ReactStringReplace(
+ t('thatsXEmailsPerSecond').replace('%1$s', emailsPerSecond.toLocaleString()),
+ /(.*?)<\/strong>/g,
+ (match, i) => {match}
+ )}
+
+
+ >
+ )}
+ {frequency === 'manual' && (
+ <>
+
+
+ {ReactStringReplace(
+ t('frequencyWarning').replace('%1$s', emailsPerSecond.toLocaleString()),
+ /(.*?)<\/strong>/g,
+ (match, i) => {match}
+ )}
+
+ >
+ )}
+
+ >
+ );
+}
+
+function formatInterval(minutes: string): string {
+ const value = Math.floor(parseInt(minutes, 10));
+ if (value > 60) return t('everyHours').replace('%1$d', `${value / 60}`);
+ if (value === 60) return t('everyHour');
+ if (value > 1) return t('everyMinutes').replace('%1$d', `${value}`);
+ return t('everyMinute');
+}
diff --git a/views/settings.html b/views/settings.html
index ae6defccfd..cb99fff22c 100644
--- a/views/settings.html
+++ b/views/settings.html
@@ -233,6 +233,13 @@
'recommended': __('recommended'),
'ownFrequency': __("I'll set my own frequency"),
'emails': __('emails'),
+ 'xEmails': __('%1$s emails'),
+ 'everyMinute': __('every minute'),
+ 'everyMinutes': __('every %1$d minutes'),
+ 'everyHour': __('every hour'),
+ 'everyHours': __('every %1$d hours'),
+ 'thatsXEmailsPerDay': __("That's
%1$s emails per day"),
+ 'thatsXEmailsPerSecond': __("That's %1$s emails per second.
We highly recommend to send 1 email per second, at the absolute maximum. MailPoet needs at least one second to process and send a single email (on most hosts.)
Alternatively, send with MailPoet, which can be up to 50 times faster."),
'frequencyWarning': __('
Warning! You may break the terms of your web host or provider by sending more than the recommended emails per day. Contact your host if you want to send more.'),
'smtpHost': __('SMTP Hostname'),
'smtpHostExample': __('e.g.: smtp.mydomain.com'),