Page 1 of 1

Email using form

Posted: Fri Dec 10, 2004 12:11 am
by ibluewave
I had my email working fine on my site and now it stopped. Hosting provider said it may have something to do with line feeds. Anyways, here is the most recent code that I have tried

$visitormail is submitted from the form

Code: Select all

<?php
				
$myemail = "test@abccompany.com"; 
		
$subject = "Visitor Mail";
				
$message = " Message: $notes\n
";
$to = "To: $myemail\r\n";
$from = "From: $visitormail\r\n";
				
mail($from, $subject, $message, $to ); 
				
?>

Posted: Fri Dec 10, 2004 12:20 am
by ol4pr0
I suggest you google around a bit, or just search this forum.

There must be a couple of examples on how to send mail.
for as far as i can see there aint much wrong with the code, but there is missing rather a few details. targeting for headers and suchs.

Posted: Fri Dec 10, 2004 12:28 am
by ibluewave
I'm all googled out! I will search the forum more but could you possibly elaborate on the use of headers?

Posted: Fri Dec 10, 2004 1:20 am
by ol4pr0
Not that i mind but.. u should use google a bit differant than :)

Code: Select all

/* subject */
$subject = "mail subject:";

/* message as html ???*/
$message = '<html><body>something in here</body></html>';

/* To send HTML mail, you can set the Content-type header. */
$headers  = "MIME-Version: 1.0\r\n";
$headers .= "Content-type: text/html; charset=iso-8859-1\r\n";
$headers .= "From: Who? <who?@mail.com>\r\n";
$headers .= "X-Sender: whosends?@mail.com\r\n";
$headers .= "X-Mailer: PHP\r\n";
$headers .= "X-Priority: 1\r\n";
$headers .= "Return-Path: whoget_bad_mail_back?@mail.com\r\n";
//$headers .= "To: You? <who?@mail.com>\r\n";


mail($mail_adress, $subject, $message, $headers);
U will need to check this, and edit some :) but besides that it should work

Posted: Fri Dec 10, 2004 1:42 am
by ibluewave
Thanks... unfortunately its a no go. I've tried over 30 different scripts off of google and from this forum with no luck. I'm thinking that it is something out side of the code that has to do with the mailserver? Any ideas?

Posted: Fri Dec 10, 2004 1:10 pm
by ol4pr0
Nope sorry, as i said before i dont see much wrong with tthe code just missing alot.

Try the provider again. If that fails, just use mailto:link@mail.com

Posted: Fri Dec 10, 2004 3:12 pm
by Joe
Try:

Code: Select all

<?php
$myemail = "test@abccompany.com";
$subject = "Visitor Mail";
$message = "Message here...";

$from = "webmaster@".$_SERVER['SERVER_NAME'];

mail($myemail, $subject, $message,"From: $from\r\n");          
?>