how to send form data without php mail function?
i'm trying to figure out my issue, i have a shared hosting provide that had the php mail function disable for security reasons.
i need to send some forms data using php, i only know how to send form data using the php mail function.
i tried using phpmailer, got ir from github, but it didn't worked.
my question is very simple, is there a workaround to send form data without the php mail function to bypass the disabled phpmail and nobody=on tweak on my shared web hosting?
thank you in advance for all the help.
this is the code i had used
<?php
function send_mail($email, $recipient_name, $message='')
{
require("phpmailer/class.phpmailer.php");
require("phpmailer/class.smtp.php");
$mail = new PHPMailer();
$mail->CharSet="utf-8";
$mail->IsSMTP();
$mail->Host = 'localhost';
$mail->Port = 465;
$mail->SMTPAuth = true;
$mail->Username = "user@mysite.com";
$mail->Password = "password";
$mail->setFrom($email, $recipient_name);
$mail->AddAddress($email, $recipient_name);
$mail->WordWrap = 50;
$mail->IsHTML(false);
$mail->Subject = "Contact form";
$mail->Body = $message;
if(!$mail->Send())
{
echo "Message could not be sent. <p>";
echo "Mailer Error: " . $mail->ErrorInfo;
exit;
}
echo "Message has been sent";
}
//vars
$subject = "Contac form";
$from = $_POST['email'];
//data
$msg = "NAME: " .$_POST['name'] ."<br><br>n";
$msg .= "EMAIL: " .$_POST['email'] ."<br><br>n";
$msg .= "WEBSITE: " .$_POST['website'] ."<br><br>n";
$msg .= "MESSAGE: " .$_POST['message'] ."<br>n";
//Headers
$headers = "MIME-Version: 1.0rn";
$headers .= "Content-type: text/html; charset=UTF-8rn";
$mail="support@mysite.com";
//send mail
//mail($mail, $subject, $msg, $headers, "-f $from");
send_mail($from, $_POST['name'], $msg);
?>
php function email security smt
add a comment |
i'm trying to figure out my issue, i have a shared hosting provide that had the php mail function disable for security reasons.
i need to send some forms data using php, i only know how to send form data using the php mail function.
i tried using phpmailer, got ir from github, but it didn't worked.
my question is very simple, is there a workaround to send form data without the php mail function to bypass the disabled phpmail and nobody=on tweak on my shared web hosting?
thank you in advance for all the help.
this is the code i had used
<?php
function send_mail($email, $recipient_name, $message='')
{
require("phpmailer/class.phpmailer.php");
require("phpmailer/class.smtp.php");
$mail = new PHPMailer();
$mail->CharSet="utf-8";
$mail->IsSMTP();
$mail->Host = 'localhost';
$mail->Port = 465;
$mail->SMTPAuth = true;
$mail->Username = "user@mysite.com";
$mail->Password = "password";
$mail->setFrom($email, $recipient_name);
$mail->AddAddress($email, $recipient_name);
$mail->WordWrap = 50;
$mail->IsHTML(false);
$mail->Subject = "Contact form";
$mail->Body = $message;
if(!$mail->Send())
{
echo "Message could not be sent. <p>";
echo "Mailer Error: " . $mail->ErrorInfo;
exit;
}
echo "Message has been sent";
}
//vars
$subject = "Contac form";
$from = $_POST['email'];
//data
$msg = "NAME: " .$_POST['name'] ."<br><br>n";
$msg .= "EMAIL: " .$_POST['email'] ."<br><br>n";
$msg .= "WEBSITE: " .$_POST['website'] ."<br><br>n";
$msg .= "MESSAGE: " .$_POST['message'] ."<br>n";
//Headers
$headers = "MIME-Version: 1.0rn";
$headers .= "Content-type: text/html; charset=UTF-8rn";
$mail="support@mysite.com";
//send mail
//mail($mail, $subject, $msg, $headers, "-f $from");
send_mail($from, $_POST['name'], $msg);
?>
php function email security smt
The "but it didn't worked" in your answer does not help. Please add the code you tried, in a simplified version so that you can it it into the question itself (ther is an edit` button below your question). Of course that library works, you will have to find out what mistake you made. We can only help with that if you show your code.
– arkascha
Nov 24 '18 at 13:25
i had added the code i used on my question, sorry my mistake for not posting it in the first time.
– Vincenzo Ravo
Nov 24 '18 at 13:51
OK, and now wenn need to know what error you actually ran into. Again "but it didn't worked" does not help, we need a specific error message.
– arkascha
Nov 24 '18 at 16:18
My guess is that the library failed to connect to the smtp server. You configured "localhost" as SMTP server... are you really sure that there is an SMTP server operated on that system? And that you have the correct authentication credentials?
– arkascha
Nov 24 '18 at 16:19
add a comment |
i'm trying to figure out my issue, i have a shared hosting provide that had the php mail function disable for security reasons.
i need to send some forms data using php, i only know how to send form data using the php mail function.
i tried using phpmailer, got ir from github, but it didn't worked.
my question is very simple, is there a workaround to send form data without the php mail function to bypass the disabled phpmail and nobody=on tweak on my shared web hosting?
thank you in advance for all the help.
this is the code i had used
<?php
function send_mail($email, $recipient_name, $message='')
{
require("phpmailer/class.phpmailer.php");
require("phpmailer/class.smtp.php");
$mail = new PHPMailer();
$mail->CharSet="utf-8";
$mail->IsSMTP();
$mail->Host = 'localhost';
$mail->Port = 465;
$mail->SMTPAuth = true;
$mail->Username = "user@mysite.com";
$mail->Password = "password";
$mail->setFrom($email, $recipient_name);
$mail->AddAddress($email, $recipient_name);
$mail->WordWrap = 50;
$mail->IsHTML(false);
$mail->Subject = "Contact form";
$mail->Body = $message;
if(!$mail->Send())
{
echo "Message could not be sent. <p>";
echo "Mailer Error: " . $mail->ErrorInfo;
exit;
}
echo "Message has been sent";
}
//vars
$subject = "Contac form";
$from = $_POST['email'];
//data
$msg = "NAME: " .$_POST['name'] ."<br><br>n";
$msg .= "EMAIL: " .$_POST['email'] ."<br><br>n";
$msg .= "WEBSITE: " .$_POST['website'] ."<br><br>n";
$msg .= "MESSAGE: " .$_POST['message'] ."<br>n";
//Headers
$headers = "MIME-Version: 1.0rn";
$headers .= "Content-type: text/html; charset=UTF-8rn";
$mail="support@mysite.com";
//send mail
//mail($mail, $subject, $msg, $headers, "-f $from");
send_mail($from, $_POST['name'], $msg);
?>
php function email security smt
i'm trying to figure out my issue, i have a shared hosting provide that had the php mail function disable for security reasons.
i need to send some forms data using php, i only know how to send form data using the php mail function.
i tried using phpmailer, got ir from github, but it didn't worked.
my question is very simple, is there a workaround to send form data without the php mail function to bypass the disabled phpmail and nobody=on tweak on my shared web hosting?
thank you in advance for all the help.
this is the code i had used
<?php
function send_mail($email, $recipient_name, $message='')
{
require("phpmailer/class.phpmailer.php");
require("phpmailer/class.smtp.php");
$mail = new PHPMailer();
$mail->CharSet="utf-8";
$mail->IsSMTP();
$mail->Host = 'localhost';
$mail->Port = 465;
$mail->SMTPAuth = true;
$mail->Username = "user@mysite.com";
$mail->Password = "password";
$mail->setFrom($email, $recipient_name);
$mail->AddAddress($email, $recipient_name);
$mail->WordWrap = 50;
$mail->IsHTML(false);
$mail->Subject = "Contact form";
$mail->Body = $message;
if(!$mail->Send())
{
echo "Message could not be sent. <p>";
echo "Mailer Error: " . $mail->ErrorInfo;
exit;
}
echo "Message has been sent";
}
//vars
$subject = "Contac form";
$from = $_POST['email'];
//data
$msg = "NAME: " .$_POST['name'] ."<br><br>n";
$msg .= "EMAIL: " .$_POST['email'] ."<br><br>n";
$msg .= "WEBSITE: " .$_POST['website'] ."<br><br>n";
$msg .= "MESSAGE: " .$_POST['message'] ."<br>n";
//Headers
$headers = "MIME-Version: 1.0rn";
$headers .= "Content-type: text/html; charset=UTF-8rn";
$mail="support@mysite.com";
//send mail
//mail($mail, $subject, $msg, $headers, "-f $from");
send_mail($from, $_POST['name'], $msg);
?>
php function email security smt
php function email security smt
edited Nov 24 '18 at 13:51
Vincenzo Ravo
asked Nov 24 '18 at 13:20
Vincenzo RavoVincenzo Ravo
44
44
The "but it didn't worked" in your answer does not help. Please add the code you tried, in a simplified version so that you can it it into the question itself (ther is an edit` button below your question). Of course that library works, you will have to find out what mistake you made. We can only help with that if you show your code.
– arkascha
Nov 24 '18 at 13:25
i had added the code i used on my question, sorry my mistake for not posting it in the first time.
– Vincenzo Ravo
Nov 24 '18 at 13:51
OK, and now wenn need to know what error you actually ran into. Again "but it didn't worked" does not help, we need a specific error message.
– arkascha
Nov 24 '18 at 16:18
My guess is that the library failed to connect to the smtp server. You configured "localhost" as SMTP server... are you really sure that there is an SMTP server operated on that system? And that you have the correct authentication credentials?
– arkascha
Nov 24 '18 at 16:19
add a comment |
The "but it didn't worked" in your answer does not help. Please add the code you tried, in a simplified version so that you can it it into the question itself (ther is an edit` button below your question). Of course that library works, you will have to find out what mistake you made. We can only help with that if you show your code.
– arkascha
Nov 24 '18 at 13:25
i had added the code i used on my question, sorry my mistake for not posting it in the first time.
– Vincenzo Ravo
Nov 24 '18 at 13:51
OK, and now wenn need to know what error you actually ran into. Again "but it didn't worked" does not help, we need a specific error message.
– arkascha
Nov 24 '18 at 16:18
My guess is that the library failed to connect to the smtp server. You configured "localhost" as SMTP server... are you really sure that there is an SMTP server operated on that system? And that you have the correct authentication credentials?
– arkascha
Nov 24 '18 at 16:19
The "but it didn't worked" in your answer does not help. Please add the code you tried, in a simplified version so that you can it it into the question itself (ther is an edit` button below your question). Of course that library works, you will have to find out what mistake you made. We can only help with that if you show your code.
– arkascha
Nov 24 '18 at 13:25
The "but it didn't worked" in your answer does not help. Please add the code you tried, in a simplified version so that you can it it into the question itself (ther is an edit` button below your question). Of course that library works, you will have to find out what mistake you made. We can only help with that if you show your code.
– arkascha
Nov 24 '18 at 13:25
i had added the code i used on my question, sorry my mistake for not posting it in the first time.
– Vincenzo Ravo
Nov 24 '18 at 13:51
i had added the code i used on my question, sorry my mistake for not posting it in the first time.
– Vincenzo Ravo
Nov 24 '18 at 13:51
OK, and now wenn need to know what error you actually ran into. Again "but it didn't worked" does not help, we need a specific error message.
– arkascha
Nov 24 '18 at 16:18
OK, and now wenn need to know what error you actually ran into. Again "but it didn't worked" does not help, we need a specific error message.
– arkascha
Nov 24 '18 at 16:18
My guess is that the library failed to connect to the smtp server. You configured "localhost" as SMTP server... are you really sure that there is an SMTP server operated on that system? And that you have the correct authentication credentials?
– arkascha
Nov 24 '18 at 16:19
My guess is that the library failed to connect to the smtp server. You configured "localhost" as SMTP server... are you really sure that there is an SMTP server operated on that system? And that you have the correct authentication credentials?
– arkascha
Nov 24 '18 at 16:19
add a comment |
2 Answers
2
active
oldest
votes
First you have to include all requirements to send Mail with PHP mailer
require 'assets/PHPMailer/PHPMailer/src/Exception.php';
require 'assets/PHPMailer/PHPMailer/src/OAuth.php';
require 'assets/PHPMailer/PHPMailer/src/PHPMailer.php';
require 'assets/PHPMailer/PHPMailer/src/POP3.php';
require 'assets/PHPMailer/PHPMailer/src/SMTP.php';
require('assets/PHPMailer/simple_html_dom.php');
After that you define settings, here is config I use: (I use gmail to send mails, to use gmail you have to enable config in your gmail to use less secure apps)
$mailSub = filter_input('insert mail subject here');
$mailMsg = $html_new;
$mailto = 'inset mail you wish to send here';
$mail = new PHPMailerPHPMailerPHPMailer();
$mail->IsSmtp();
$mail->SMTPDebug = 0;
$mail->SMTPAuth = true;
$mail->SMTPSecure = 'ssl';
$mail->Host = 'smtp.gmail.com';
$mail->Port = 465;
$mail->IsHTML(true);
$mail->CharSet = 'UTF-8';
// LOGIN INFO TO YOUR GMAIL
$mail->Username = 'gmail';
$mail->Password = 'password for gmail';
$mail->SetFrom('name you wish to show as sender');
//-------------------------------------------
$mail->Subject = 'subject';
$mail->Body = 'body of a mail, you can use html here';
$mail->AddAddress('reciever mail');
$mail->SMTPOptions = array(
'ssl' => array(
'verify_peer' => false,
'verify_peer_name' => false,
'allow_self_signed' => true
)
);
$mail->Send()
Here is a link to my github repo with full app that utilize php mailer, maybe it would be of some help.
add a comment |
In essence it all boils down to knowing the environment your shared hosting provider is giving you.
Since they disable php's mail() function, I presume they are trying to not have to deal with spammers using their services.
So they probably also will not run an SMTP service on localhost, and most likely will filter out outgoing traffic to port 25 to prevent you from delivering it on other mail servers as well. But again: they might not (yet).
But it's worth checking out what is available:
- Is there an SMTP service running on localhost ?
- Is there any outgoing relay SMTP service they provide for their legitimate customers ?
- Do they filter outgoing SMTP on port 25 to the rest of the world ?
- Do they allow you to connect to authenticated SMTP services for delivery ?
It's a bit of work and how to get the answers depend a lot on how minimal the service is that you get and what other resources you have around the internet. Anyway the easiest is to simply ask your supplier: they know what they allow, what they block and what they want to do next depending on where they are trying to get rid of spammers.
Anyway, your best bet is to use authenticated delivery towards a google server with a destination address on gmail or so. That's the least likely to get filtered away by either Google or a shared hosting provider who know what they do. Take care: authenticated delivery means the webserver has a way to authenticate towards google, so if the separation between different customers is suboptimal (it's by far not always foolproof), your "neighbours" in the shared hosting can get to those credentials with relative ease, so make sure it's not an account you care about a lot - hence: create a gmail address just for that use...
If they don't allow anything. You can still save the email on the server, retrieve it from a desktop or other server and send it from there with some programming.
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53458563%2fhow-to-send-form-data-without-php-mail-function%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
First you have to include all requirements to send Mail with PHP mailer
require 'assets/PHPMailer/PHPMailer/src/Exception.php';
require 'assets/PHPMailer/PHPMailer/src/OAuth.php';
require 'assets/PHPMailer/PHPMailer/src/PHPMailer.php';
require 'assets/PHPMailer/PHPMailer/src/POP3.php';
require 'assets/PHPMailer/PHPMailer/src/SMTP.php';
require('assets/PHPMailer/simple_html_dom.php');
After that you define settings, here is config I use: (I use gmail to send mails, to use gmail you have to enable config in your gmail to use less secure apps)
$mailSub = filter_input('insert mail subject here');
$mailMsg = $html_new;
$mailto = 'inset mail you wish to send here';
$mail = new PHPMailerPHPMailerPHPMailer();
$mail->IsSmtp();
$mail->SMTPDebug = 0;
$mail->SMTPAuth = true;
$mail->SMTPSecure = 'ssl';
$mail->Host = 'smtp.gmail.com';
$mail->Port = 465;
$mail->IsHTML(true);
$mail->CharSet = 'UTF-8';
// LOGIN INFO TO YOUR GMAIL
$mail->Username = 'gmail';
$mail->Password = 'password for gmail';
$mail->SetFrom('name you wish to show as sender');
//-------------------------------------------
$mail->Subject = 'subject';
$mail->Body = 'body of a mail, you can use html here';
$mail->AddAddress('reciever mail');
$mail->SMTPOptions = array(
'ssl' => array(
'verify_peer' => false,
'verify_peer_name' => false,
'allow_self_signed' => true
)
);
$mail->Send()
Here is a link to my github repo with full app that utilize php mailer, maybe it would be of some help.
add a comment |
First you have to include all requirements to send Mail with PHP mailer
require 'assets/PHPMailer/PHPMailer/src/Exception.php';
require 'assets/PHPMailer/PHPMailer/src/OAuth.php';
require 'assets/PHPMailer/PHPMailer/src/PHPMailer.php';
require 'assets/PHPMailer/PHPMailer/src/POP3.php';
require 'assets/PHPMailer/PHPMailer/src/SMTP.php';
require('assets/PHPMailer/simple_html_dom.php');
After that you define settings, here is config I use: (I use gmail to send mails, to use gmail you have to enable config in your gmail to use less secure apps)
$mailSub = filter_input('insert mail subject here');
$mailMsg = $html_new;
$mailto = 'inset mail you wish to send here';
$mail = new PHPMailerPHPMailerPHPMailer();
$mail->IsSmtp();
$mail->SMTPDebug = 0;
$mail->SMTPAuth = true;
$mail->SMTPSecure = 'ssl';
$mail->Host = 'smtp.gmail.com';
$mail->Port = 465;
$mail->IsHTML(true);
$mail->CharSet = 'UTF-8';
// LOGIN INFO TO YOUR GMAIL
$mail->Username = 'gmail';
$mail->Password = 'password for gmail';
$mail->SetFrom('name you wish to show as sender');
//-------------------------------------------
$mail->Subject = 'subject';
$mail->Body = 'body of a mail, you can use html here';
$mail->AddAddress('reciever mail');
$mail->SMTPOptions = array(
'ssl' => array(
'verify_peer' => false,
'verify_peer_name' => false,
'allow_self_signed' => true
)
);
$mail->Send()
Here is a link to my github repo with full app that utilize php mailer, maybe it would be of some help.
add a comment |
First you have to include all requirements to send Mail with PHP mailer
require 'assets/PHPMailer/PHPMailer/src/Exception.php';
require 'assets/PHPMailer/PHPMailer/src/OAuth.php';
require 'assets/PHPMailer/PHPMailer/src/PHPMailer.php';
require 'assets/PHPMailer/PHPMailer/src/POP3.php';
require 'assets/PHPMailer/PHPMailer/src/SMTP.php';
require('assets/PHPMailer/simple_html_dom.php');
After that you define settings, here is config I use: (I use gmail to send mails, to use gmail you have to enable config in your gmail to use less secure apps)
$mailSub = filter_input('insert mail subject here');
$mailMsg = $html_new;
$mailto = 'inset mail you wish to send here';
$mail = new PHPMailerPHPMailerPHPMailer();
$mail->IsSmtp();
$mail->SMTPDebug = 0;
$mail->SMTPAuth = true;
$mail->SMTPSecure = 'ssl';
$mail->Host = 'smtp.gmail.com';
$mail->Port = 465;
$mail->IsHTML(true);
$mail->CharSet = 'UTF-8';
// LOGIN INFO TO YOUR GMAIL
$mail->Username = 'gmail';
$mail->Password = 'password for gmail';
$mail->SetFrom('name you wish to show as sender');
//-------------------------------------------
$mail->Subject = 'subject';
$mail->Body = 'body of a mail, you can use html here';
$mail->AddAddress('reciever mail');
$mail->SMTPOptions = array(
'ssl' => array(
'verify_peer' => false,
'verify_peer_name' => false,
'allow_self_signed' => true
)
);
$mail->Send()
Here is a link to my github repo with full app that utilize php mailer, maybe it would be of some help.
First you have to include all requirements to send Mail with PHP mailer
require 'assets/PHPMailer/PHPMailer/src/Exception.php';
require 'assets/PHPMailer/PHPMailer/src/OAuth.php';
require 'assets/PHPMailer/PHPMailer/src/PHPMailer.php';
require 'assets/PHPMailer/PHPMailer/src/POP3.php';
require 'assets/PHPMailer/PHPMailer/src/SMTP.php';
require('assets/PHPMailer/simple_html_dom.php');
After that you define settings, here is config I use: (I use gmail to send mails, to use gmail you have to enable config in your gmail to use less secure apps)
$mailSub = filter_input('insert mail subject here');
$mailMsg = $html_new;
$mailto = 'inset mail you wish to send here';
$mail = new PHPMailerPHPMailerPHPMailer();
$mail->IsSmtp();
$mail->SMTPDebug = 0;
$mail->SMTPAuth = true;
$mail->SMTPSecure = 'ssl';
$mail->Host = 'smtp.gmail.com';
$mail->Port = 465;
$mail->IsHTML(true);
$mail->CharSet = 'UTF-8';
// LOGIN INFO TO YOUR GMAIL
$mail->Username = 'gmail';
$mail->Password = 'password for gmail';
$mail->SetFrom('name you wish to show as sender');
//-------------------------------------------
$mail->Subject = 'subject';
$mail->Body = 'body of a mail, you can use html here';
$mail->AddAddress('reciever mail');
$mail->SMTPOptions = array(
'ssl' => array(
'verify_peer' => false,
'verify_peer_name' => false,
'allow_self_signed' => true
)
);
$mail->Send()
Here is a link to my github repo with full app that utilize php mailer, maybe it would be of some help.
answered Nov 24 '18 at 22:50
Nikola PavlovićNikola Pavlović
11115
11115
add a comment |
add a comment |
In essence it all boils down to knowing the environment your shared hosting provider is giving you.
Since they disable php's mail() function, I presume they are trying to not have to deal with spammers using their services.
So they probably also will not run an SMTP service on localhost, and most likely will filter out outgoing traffic to port 25 to prevent you from delivering it on other mail servers as well. But again: they might not (yet).
But it's worth checking out what is available:
- Is there an SMTP service running on localhost ?
- Is there any outgoing relay SMTP service they provide for their legitimate customers ?
- Do they filter outgoing SMTP on port 25 to the rest of the world ?
- Do they allow you to connect to authenticated SMTP services for delivery ?
It's a bit of work and how to get the answers depend a lot on how minimal the service is that you get and what other resources you have around the internet. Anyway the easiest is to simply ask your supplier: they know what they allow, what they block and what they want to do next depending on where they are trying to get rid of spammers.
Anyway, your best bet is to use authenticated delivery towards a google server with a destination address on gmail or so. That's the least likely to get filtered away by either Google or a shared hosting provider who know what they do. Take care: authenticated delivery means the webserver has a way to authenticate towards google, so if the separation between different customers is suboptimal (it's by far not always foolproof), your "neighbours" in the shared hosting can get to those credentials with relative ease, so make sure it's not an account you care about a lot - hence: create a gmail address just for that use...
If they don't allow anything. You can still save the email on the server, retrieve it from a desktop or other server and send it from there with some programming.
add a comment |
In essence it all boils down to knowing the environment your shared hosting provider is giving you.
Since they disable php's mail() function, I presume they are trying to not have to deal with spammers using their services.
So they probably also will not run an SMTP service on localhost, and most likely will filter out outgoing traffic to port 25 to prevent you from delivering it on other mail servers as well. But again: they might not (yet).
But it's worth checking out what is available:
- Is there an SMTP service running on localhost ?
- Is there any outgoing relay SMTP service they provide for their legitimate customers ?
- Do they filter outgoing SMTP on port 25 to the rest of the world ?
- Do they allow you to connect to authenticated SMTP services for delivery ?
It's a bit of work and how to get the answers depend a lot on how minimal the service is that you get and what other resources you have around the internet. Anyway the easiest is to simply ask your supplier: they know what they allow, what they block and what they want to do next depending on where they are trying to get rid of spammers.
Anyway, your best bet is to use authenticated delivery towards a google server with a destination address on gmail or so. That's the least likely to get filtered away by either Google or a shared hosting provider who know what they do. Take care: authenticated delivery means the webserver has a way to authenticate towards google, so if the separation between different customers is suboptimal (it's by far not always foolproof), your "neighbours" in the shared hosting can get to those credentials with relative ease, so make sure it's not an account you care about a lot - hence: create a gmail address just for that use...
If they don't allow anything. You can still save the email on the server, retrieve it from a desktop or other server and send it from there with some programming.
add a comment |
In essence it all boils down to knowing the environment your shared hosting provider is giving you.
Since they disable php's mail() function, I presume they are trying to not have to deal with spammers using their services.
So they probably also will not run an SMTP service on localhost, and most likely will filter out outgoing traffic to port 25 to prevent you from delivering it on other mail servers as well. But again: they might not (yet).
But it's worth checking out what is available:
- Is there an SMTP service running on localhost ?
- Is there any outgoing relay SMTP service they provide for their legitimate customers ?
- Do they filter outgoing SMTP on port 25 to the rest of the world ?
- Do they allow you to connect to authenticated SMTP services for delivery ?
It's a bit of work and how to get the answers depend a lot on how minimal the service is that you get and what other resources you have around the internet. Anyway the easiest is to simply ask your supplier: they know what they allow, what they block and what they want to do next depending on where they are trying to get rid of spammers.
Anyway, your best bet is to use authenticated delivery towards a google server with a destination address on gmail or so. That's the least likely to get filtered away by either Google or a shared hosting provider who know what they do. Take care: authenticated delivery means the webserver has a way to authenticate towards google, so if the separation between different customers is suboptimal (it's by far not always foolproof), your "neighbours" in the shared hosting can get to those credentials with relative ease, so make sure it's not an account you care about a lot - hence: create a gmail address just for that use...
If they don't allow anything. You can still save the email on the server, retrieve it from a desktop or other server and send it from there with some programming.
In essence it all boils down to knowing the environment your shared hosting provider is giving you.
Since they disable php's mail() function, I presume they are trying to not have to deal with spammers using their services.
So they probably also will not run an SMTP service on localhost, and most likely will filter out outgoing traffic to port 25 to prevent you from delivering it on other mail servers as well. But again: they might not (yet).
But it's worth checking out what is available:
- Is there an SMTP service running on localhost ?
- Is there any outgoing relay SMTP service they provide for their legitimate customers ?
- Do they filter outgoing SMTP on port 25 to the rest of the world ?
- Do they allow you to connect to authenticated SMTP services for delivery ?
It's a bit of work and how to get the answers depend a lot on how minimal the service is that you get and what other resources you have around the internet. Anyway the easiest is to simply ask your supplier: they know what they allow, what they block and what they want to do next depending on where they are trying to get rid of spammers.
Anyway, your best bet is to use authenticated delivery towards a google server with a destination address on gmail or so. That's the least likely to get filtered away by either Google or a shared hosting provider who know what they do. Take care: authenticated delivery means the webserver has a way to authenticate towards google, so if the separation between different customers is suboptimal (it's by far not always foolproof), your "neighbours" in the shared hosting can get to those credentials with relative ease, so make sure it's not an account you care about a lot - hence: create a gmail address just for that use...
If they don't allow anything. You can still save the email on the server, retrieve it from a desktop or other server and send it from there with some programming.
edited Nov 24 '18 at 23:19
answered Nov 24 '18 at 22:42
user3277192
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53458563%2fhow-to-send-form-data-without-php-mail-function%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
The "but it didn't worked" in your answer does not help. Please add the code you tried, in a simplified version so that you can it it into the question itself (ther is an edit` button below your question). Of course that library works, you will have to find out what mistake you made. We can only help with that if you show your code.
– arkascha
Nov 24 '18 at 13:25
i had added the code i used on my question, sorry my mistake for not posting it in the first time.
– Vincenzo Ravo
Nov 24 '18 at 13:51
OK, and now wenn need to know what error you actually ran into. Again "but it didn't worked" does not help, we need a specific error message.
– arkascha
Nov 24 '18 at 16:18
My guess is that the library failed to connect to the smtp server. You configured "localhost" as SMTP server... are you really sure that there is an SMTP server operated on that system? And that you have the correct authentication credentials?
– arkascha
Nov 24 '18 at 16:19