Mail() Problem

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
lazersam
Forum Contributor
Posts: 105
Joined: Sat Nov 15, 2003 4:07 am
Location: Hertfordshire, UK

Mail() Problem

Post by lazersam »

Hi all

I am writing a script that sends emails with the mail() function. All of a sudden it stopped sending. I have not changed the code at all. Here's a test version that does not work on my server.

Code: Select all

<?php


                $email = "myemail@hotmail.com";
                $email_msg = "Test";


#Get email headers===
	
	$headers  = "MIME-Version: 1.0\r\n"; 
	$headers .= "Content-type: text/html; charset=iso-8859-1\r\n";
	$headers .="From: me@mywebsite.com <me@mywebsite.com >\r\n";
	
#Send email====
  			
$success=mail($email, "Welcome.", $email_msg, $headers);
		
	If (!$success){
		echo "Error Sending email. Please contact us. <BR>";
		exit();
		}else{
		echo "email sent!<br>";
		}
	
		


?>
I am renting virtual space on a server. Do you think they have suspended my mailing or something? I have asked them.

ALSO does anyone know if I am able to edit the php.ini file on a virtual server? Does every web account have its own php.ini file or is there just one for the who server?

Thanks


Larry
User avatar
maqmus
Forum Commoner
Posts: 30
Joined: Mon Mar 08, 2004 1:10 pm

Post by maqmus »

I tried your code and it worked. I just deleted the empty spaces cause I found there invisible codes.
User avatar
maqmus
Forum Commoner
Posts: 30
Joined: Mon Mar 08, 2004 1:10 pm

Post by maqmus »

In virtual hosting you wont have access to the php.ini file.
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

...but you may be able to use [php_man]ini_set[/php_man]() and/or .htaccess files..
bla5e
Forum Contributor
Posts: 234
Joined: Tue May 25, 2004 4:28 pm

Post by bla5e »

ill fix it when i get back from class
User avatar
lazersam
Forum Contributor
Posts: 105
Joined: Sat Nov 15, 2003 4:07 am
Location: Hertfordshire, UK

Post by lazersam »

So, there is nothing wrong with my code then?
User avatar
lazersam
Forum Contributor
Posts: 105
Joined: Sat Nov 15, 2003 4:07 am
Location: Hertfordshire, UK

Post by lazersam »

I have just got an email from my server who said my email was disabled to avoid spamming. They said they have enabled it again.

Thank goodness.
Post Reply