Jump to content

Recommended Posts

I've been struggling for hours! :S.  I have a go daddy account, i've set up an email there and then i try a simple script :

 

$sent = mail('stijn03@hotmail.com','test','test');

if($sent){
echo 'mail verstuurd';


} else echo 'mail niet verstuurd';

 

I always display 'mail verstuurd' (succesfull)... but still, when i look in my hotmail account, i see no mail :S. Can i test it locally? Because go daddy is driving me crazy with this mail thing

Link to comment
https://forums.phpfreaks.com/topic/265717-mail/
Share on other sites

try adding headers helps avoid it being selt to junkmail.

 

 

$headers = "MIME-Version: 1.0\r\n"
  ."Content-Type: text/plain; charset=utf-8\r\n"
  ."Content-Transfer-Encoding: 8bit\r\n"
  ."X-Mailer: PHP/". phpversion();

$sent = mail('stijn03@hotmail.com','test','test',$headers);

if($sent){



echo 'mail verstuurd';









} else echo 'mail niet verstuurd';

Link to comment
https://forums.phpfreaks.com/topic/265717-mail/#findComment-1361791
Share on other sites

I use a seperate mailme.php on all my email setups...here is my page i use regularly

 

 <?php


//--------------------------Set these paramaters--------------------------


$subject = 'subject Order';                // Subject of email sent to you.
$emailadd = 'email@email.com';        // Your email address. This is where the form information will be sent.
//$url = '';               // Where to redirect after form is processed.
$req = '0';                                  // Makes all fields required. If set to '1' no field can not be empty. If set to '0' any or all fields can be empty.

// --------------------------Do not edit below this line--------------------------
$text = "email title:\n\n";       
$space = '  ';
$line = '
';
foreach ($_POST as $key => $value)
{
if ($req == '1')
{
	if ($value == '')
	{echo "$key is empty";die;}
}
$j = strlen($key);
	if ($j >= 20)
	{echo "Name of form element $key cannot be longer than 30 characters";die;}
$j = 20 - $j;
	for ($i = 1; $i <= $j; $i++)
	{$space .= ' ';}
$value = str_replace('\n', "$line", $value);
$conc = "{$key}:$space{$value}$line";
$text .= $conc;
$space = '  ';
}
mail($emailadd, $subject, $text, 'From: '.$emailadd.'');
//echo '<META HTTP-EQUIV=Refresh CONTENT="0; URL='.$url.'">';
?> 

Link to comment
https://forums.phpfreaks.com/topic/265717-mail/#findComment-1361973
Share on other sites

Thanks for the replies, but i think my php script for sending mails works perfectly. It's just about the smtp setup.

 

when i use godaddy's smtp server, it's a bit messy and works not properly, also the scripts need to be hosted on their server in order to use the outgoing smtp server apparently.

 

So now, i want to test the mail function also locally, like i test my script locally using WAMP (php, apache, mysql). Has anybody experience with using a locallly installed stmp that works with wamp??

Link to comment
https://forums.phpfreaks.com/topic/265717-mail/#findComment-1362376
Share on other sites

Hello fellow Dutchie...

 

Have you tried this:

 


$to ="stijn03@hotmail.com";
$subject ="Stijn zijn Contact Formulier";
$email = $_POST["fromwhosemail"];
mail($to,$subject,$message,"From: $email");

 

I think, it doesn't send an email, because there's no headers. Those are not optional, if my memory serves me correct they are mandatory in the mail function.

Link to comment
https://forums.phpfreaks.com/topic/265717-mail/#findComment-1362416
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.