Jump to content

[SOLVED] email not working


ident

Recommended Posts

<?php
//add the header
include('header.php');
//define the receiver of the email
$to = '[email protected]';
//define the subject of the email
$subject = 'Test email';
//define the message to be sent. Each line should be separated with \n
$message = "Hello World!\n\nThis is my first mail.";
//define the headers we want passed. Note that they are separated with \r\n
$headers = "From: [email protected]\r\nReply-To: [email protected]";
//send the email
$mail_sent = @mail( $to, $subject, $message, $headers );
//if the message is sent successfully print "Mail sent". Otherwise print "Mail failed" 

echo $mail_sent ? "<br /><center>Mail sent" : "Mail failed</center>";
?>

 

any one know why?

Link to comment
https://forums.phpfreaks.com/topic/174892-solved-email-not-working/
Share on other sites

Hmm maybe it's something iv not set up then.

 

I have my own email server that i use. But i have only just hosted my site to my server and then added this code.

 

You mention a php.ini, but i have never write or seen one. is there something i must set up first on my server then?

huh, so you have host not server, i think this is why it's not working...

php.ini file can be found in php server folder, i don't think you have access to that file if you have only host

if your host allows you to use SMTP your problem can be solved. just look at your host options and see then post here yes or no

 

btw, if you have free hosting services it won't work your method since they protect from spammers...

huh, so you have host not server, i think this is why it's not working...

php.ini file can be found in php server folder, i don't think you have access to that file if you have only host

if your host allows you to use SMTP your problem can be solved. just look at your host options and see then post here yes or no

 

Hi, I have my own server that i pay alot of money for. But i have not much idea about it as my mate set it up for me. I brought it from ovh

 

Your server is a Debian 5.0 (Lenny) based system.

 

Please find below the connection settings to your server.

 

SETTINGS SERVER:

talk to your buddy and solve the problem. the script woks perfect. you may check your email to see you've got one email, and was sent with your script and my hosted domain...

 

copy of the file used to send you the email:

 

<html>
<body>
<?php
//add the header
include('header.php');
//define the receiver of the email
$to = '[email protected]';
//define the subject of the email
$subject = 'Test email - work it work server test';
//define the message to be sent. Each line should be separated with \n
$message = "Hello World!\n\nThis is my first mail. <br> just uploaded your script on my host and it works";
//define the headers we want passed. Note that they are separated with \r\n
$headers = "From: [email protected]\r\nReply-To: [email protected]";
//send the email
$mail_sent = @mail( $to, $subject, $message, $headers );
//if the message is sent successfully print "Mail sent". Otherwise print "Mail failed" 

echo $mail_sent ? "<br /><center>Mail sent" : "Mail failed</center>";
?>
<body>

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.