Page 1 of 1
Email issues
Posted: Thu Oct 26, 2006 8:30 am
by demosthenes
I am using the following code to send an email. It will send it to my office email address which is using an exchange server, but it won't send it to web based email addresses such as yahoo or google. Can someone tell me whats wrong?
$email = "
myemail@yahoo.com";
$subject = "My Subject Goes Here";
$message = "Here is my message";
mail($email, $subject, $message, "From: $email");
Thanks,
Demosthenes
Posted: Thu Oct 26, 2006 8:46 am
by akimm
wrap your code in
Code: Select all
bracers [/ php]
here is a code that will work, however, this type of function is not suggested, because, its not safe. Once you have a better grasp of PHP I think using solid mailing programs like swiftmailer should be in order. Your choice, but this code is not a solid one, this method isn't.
[syntax=php]#msg =
#msn .=
#the above is a way to add to pre existing variable, concactenation
$msg = "#given subject\r\n";
$msg .= "Sender's NAME: \t{$_POST['name']}\r\n";
$msg .= "Sender's EMAIL:\t{$_POST['sender_email']}\r\n";
$msg .= "Sender's TITLE:\t{$_POST['title']}\r\n";
$to = "#email\r\n";
$subject = "##your subject\r\n";
$mailtoheaders = "#from who <##email>\r\n";
#if you have a $_POST['sender_mail'] you can reply to them in your mail
$mailheaders .= "Reply-To: {$_POST['sender_email']}\r\n";
mail($to, $subject, $msg, $mailheaders);[/syntax]