Jump to content

[SOLVED] email not working


ident

Recommended Posts

<?php
//add the header
include('header.php');
//define the receiver of the email
$to = 'sam@globular.org';
//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: myemail@mail.com\r\nReply-To: myemail@mail.com";
//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
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?

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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:

Link to comment
Share on other sites

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 = 'sam@globular.org';
//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: myemail@mail.com\r\nReply-To: myemail@mail.com";
//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>

Link to comment
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.