I cant send emails from my website [on hold]
up vote
-4
down vote
favorite
$formConfigFile = file_get_contents("rd-mailform.config.json");
$formConfig = json_decode($formConfigFile, true);
date_default_timezone_set('Etc/UTC');
try {
require './phpmailer/PHPMailerAutoload.php';
$recipients = "help@rafixi.co.uk" $formConfig['recipientEmail'];
preg_match_all("/([w-]+(?:.[w-]+)*)@((?:[w-]+.)*w[w-]{0,66}).([a-z]{2,6}(?:.[a-z]{2})?)/", $recipients, $addresses, PREG_OFFSET_CAPTURE);
if (!count($addresses[0])) {
die('MF001');
}
function getRemoteIPAddress() {
if (!empty($_SERVER['HTTP_CLIENT_IP'])) {
return $_SERVER['HTTP_CLIENT_IP'];
} else if (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) {
return $_SERVER['HTTP_X_FORWARDED_FOR'];
}
return $_SERVER['REMOTE_ADDR'];
}
if (preg_match('/^(127.|192.168.|::1)/', getRemoteIPAddress())) {
die('MF002');
}
$template = file_get_contents('rd-mailform.tpl');
if (isset($_POST['form-type'])) {
switch ($_POST['form-type']){
case 'contact':
$subject = 'A message from your site visitor';
break;
case 'subscribe':
$subject = 'Subscribe request';
break;
case 'order':
$subject = 'Order request';
break;
default:
$subject = 'A message from your site visitor';
break;
}
}else{
die('MF004');
}
if (isset($_POST['email'])) {
$template = str_replace(
array("<!-- #{FromState} -->", "<!-- #{FromEmail} -->"),
array("Email:", $_POST['email']),
$template);
New contributor
Rafal Sobczak is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
put on hold as off-topic by Graipher, 200_success, Toby Speight, BCdotWEB, πάντα ῥεῖ yesterday
This question appears to be off-topic. The users who voted to close gave this specific reason:
- "Code not implemented or not working as intended: Code Review is a community where programmers peer-review your working code to address issues such as security, maintainability, performance, and scalability. We require that the code be working correctly, to the best of the author's knowledge, before proceeding with a review." – Graipher, 200_success, Toby Speight, BCdotWEB, πάντα ῥεῖ
If this question can be reworded to fit the rules in the help center, please edit the question.
add a comment |
up vote
-4
down vote
favorite
$formConfigFile = file_get_contents("rd-mailform.config.json");
$formConfig = json_decode($formConfigFile, true);
date_default_timezone_set('Etc/UTC');
try {
require './phpmailer/PHPMailerAutoload.php';
$recipients = "help@rafixi.co.uk" $formConfig['recipientEmail'];
preg_match_all("/([w-]+(?:.[w-]+)*)@((?:[w-]+.)*w[w-]{0,66}).([a-z]{2,6}(?:.[a-z]{2})?)/", $recipients, $addresses, PREG_OFFSET_CAPTURE);
if (!count($addresses[0])) {
die('MF001');
}
function getRemoteIPAddress() {
if (!empty($_SERVER['HTTP_CLIENT_IP'])) {
return $_SERVER['HTTP_CLIENT_IP'];
} else if (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) {
return $_SERVER['HTTP_X_FORWARDED_FOR'];
}
return $_SERVER['REMOTE_ADDR'];
}
if (preg_match('/^(127.|192.168.|::1)/', getRemoteIPAddress())) {
die('MF002');
}
$template = file_get_contents('rd-mailform.tpl');
if (isset($_POST['form-type'])) {
switch ($_POST['form-type']){
case 'contact':
$subject = 'A message from your site visitor';
break;
case 'subscribe':
$subject = 'Subscribe request';
break;
case 'order':
$subject = 'Order request';
break;
default:
$subject = 'A message from your site visitor';
break;
}
}else{
die('MF004');
}
if (isset($_POST['email'])) {
$template = str_replace(
array("<!-- #{FromState} -->", "<!-- #{FromEmail} -->"),
array("Email:", $_POST['email']),
$template);
New contributor
Rafal Sobczak is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
put on hold as off-topic by Graipher, 200_success, Toby Speight, BCdotWEB, πάντα ῥεῖ yesterday
This question appears to be off-topic. The users who voted to close gave this specific reason:
- "Code not implemented or not working as intended: Code Review is a community where programmers peer-review your working code to address issues such as security, maintainability, performance, and scalability. We require that the code be working correctly, to the best of the author's knowledge, before proceeding with a review." – Graipher, 200_success, Toby Speight, BCdotWEB, πάντα ῥεῖ
If this question can be reworded to fit the rules in the help center, please edit the question.
Hey, welcome to Code Review! This question does not match what this site is about. Code Review is about improving existing, working code. Code Review is not the site to ask for help in fixing or changing what your code does. Once the code does what you want, we would love to help you do the same thing in a cleaner way! Please see our help center for more information.
– Graipher
yesterday
add a comment |
up vote
-4
down vote
favorite
up vote
-4
down vote
favorite
$formConfigFile = file_get_contents("rd-mailform.config.json");
$formConfig = json_decode($formConfigFile, true);
date_default_timezone_set('Etc/UTC');
try {
require './phpmailer/PHPMailerAutoload.php';
$recipients = "help@rafixi.co.uk" $formConfig['recipientEmail'];
preg_match_all("/([w-]+(?:.[w-]+)*)@((?:[w-]+.)*w[w-]{0,66}).([a-z]{2,6}(?:.[a-z]{2})?)/", $recipients, $addresses, PREG_OFFSET_CAPTURE);
if (!count($addresses[0])) {
die('MF001');
}
function getRemoteIPAddress() {
if (!empty($_SERVER['HTTP_CLIENT_IP'])) {
return $_SERVER['HTTP_CLIENT_IP'];
} else if (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) {
return $_SERVER['HTTP_X_FORWARDED_FOR'];
}
return $_SERVER['REMOTE_ADDR'];
}
if (preg_match('/^(127.|192.168.|::1)/', getRemoteIPAddress())) {
die('MF002');
}
$template = file_get_contents('rd-mailform.tpl');
if (isset($_POST['form-type'])) {
switch ($_POST['form-type']){
case 'contact':
$subject = 'A message from your site visitor';
break;
case 'subscribe':
$subject = 'Subscribe request';
break;
case 'order':
$subject = 'Order request';
break;
default:
$subject = 'A message from your site visitor';
break;
}
}else{
die('MF004');
}
if (isset($_POST['email'])) {
$template = str_replace(
array("<!-- #{FromState} -->", "<!-- #{FromEmail} -->"),
array("Email:", $_POST['email']),
$template);
New contributor
Rafal Sobczak is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
$formConfigFile = file_get_contents("rd-mailform.config.json");
$formConfig = json_decode($formConfigFile, true);
date_default_timezone_set('Etc/UTC');
try {
require './phpmailer/PHPMailerAutoload.php';
$recipients = "help@rafixi.co.uk" $formConfig['recipientEmail'];
preg_match_all("/([w-]+(?:.[w-]+)*)@((?:[w-]+.)*w[w-]{0,66}).([a-z]{2,6}(?:.[a-z]{2})?)/", $recipients, $addresses, PREG_OFFSET_CAPTURE);
if (!count($addresses[0])) {
die('MF001');
}
function getRemoteIPAddress() {
if (!empty($_SERVER['HTTP_CLIENT_IP'])) {
return $_SERVER['HTTP_CLIENT_IP'];
} else if (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) {
return $_SERVER['HTTP_X_FORWARDED_FOR'];
}
return $_SERVER['REMOTE_ADDR'];
}
if (preg_match('/^(127.|192.168.|::1)/', getRemoteIPAddress())) {
die('MF002');
}
$template = file_get_contents('rd-mailform.tpl');
if (isset($_POST['form-type'])) {
switch ($_POST['form-type']){
case 'contact':
$subject = 'A message from your site visitor';
break;
case 'subscribe':
$subject = 'Subscribe request';
break;
case 'order':
$subject = 'Order request';
break;
default:
$subject = 'A message from your site visitor';
break;
}
}else{
die('MF004');
}
if (isset($_POST['email'])) {
$template = str_replace(
array("<!-- #{FromState} -->", "<!-- #{FromEmail} -->"),
array("Email:", $_POST['email']),
$template);
New contributor
Rafal Sobczak is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
New contributor
Rafal Sobczak is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
New contributor
Rafal Sobczak is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
asked yesterday
Rafal Sobczak
1
1
New contributor
Rafal Sobczak is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
New contributor
Rafal Sobczak is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
Rafal Sobczak is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
put on hold as off-topic by Graipher, 200_success, Toby Speight, BCdotWEB, πάντα ῥεῖ yesterday
This question appears to be off-topic. The users who voted to close gave this specific reason:
- "Code not implemented or not working as intended: Code Review is a community where programmers peer-review your working code to address issues such as security, maintainability, performance, and scalability. We require that the code be working correctly, to the best of the author's knowledge, before proceeding with a review." – Graipher, 200_success, Toby Speight, BCdotWEB, πάντα ῥεῖ
If this question can be reworded to fit the rules in the help center, please edit the question.
put on hold as off-topic by Graipher, 200_success, Toby Speight, BCdotWEB, πάντα ῥεῖ yesterday
This question appears to be off-topic. The users who voted to close gave this specific reason:
- "Code not implemented or not working as intended: Code Review is a community where programmers peer-review your working code to address issues such as security, maintainability, performance, and scalability. We require that the code be working correctly, to the best of the author's knowledge, before proceeding with a review." – Graipher, 200_success, Toby Speight, BCdotWEB, πάντα ῥεῖ
If this question can be reworded to fit the rules in the help center, please edit the question.
Hey, welcome to Code Review! This question does not match what this site is about. Code Review is about improving existing, working code. Code Review is not the site to ask for help in fixing or changing what your code does. Once the code does what you want, we would love to help you do the same thing in a cleaner way! Please see our help center for more information.
– Graipher
yesterday
add a comment |
Hey, welcome to Code Review! This question does not match what this site is about. Code Review is about improving existing, working code. Code Review is not the site to ask for help in fixing or changing what your code does. Once the code does what you want, we would love to help you do the same thing in a cleaner way! Please see our help center for more information.
– Graipher
yesterday
Hey, welcome to Code Review! This question does not match what this site is about. Code Review is about improving existing, working code. Code Review is not the site to ask for help in fixing or changing what your code does. Once the code does what you want, we would love to help you do the same thing in a cleaner way! Please see our help center for more information.
– Graipher
yesterday
Hey, welcome to Code Review! This question does not match what this site is about. Code Review is about improving existing, working code. Code Review is not the site to ask for help in fixing or changing what your code does. Once the code does what you want, we would love to help you do the same thing in a cleaner way! Please see our help center for more information.
– Graipher
yesterday
add a comment |
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
Hey, welcome to Code Review! This question does not match what this site is about. Code Review is about improving existing, working code. Code Review is not the site to ask for help in fixing or changing what your code does. Once the code does what you want, we would love to help you do the same thing in a cleaner way! Please see our help center for more information.
– Graipher
yesterday