Ok i have a couple email functions, the one that works, sends an email to the recipiant and the one that doesnt work how i want it sends an email with an activation link in it.
the working email says its from support@domain.com (like i want it to say)
but the broken one says its from domain@host299.hostmonster.com (not what i want)
but the functions are nearly identicle... what is the problem. what do you suggest i do to fix it? am i not seeing something that im doing wrong?
im going to cry foreal lol
thanks for the help guys
Just look for the email functions and ull see where im talking about.
this doesnt work like i want it to
function sendVerificationEmail($email, $code){
$to = $email;
$subject = "Please activate your account at ".SITE_NAME;
$from = "registration@domain.com";
$headers = "From: $from\n".
"Reply-To: support@domain.com\n".
"X-Mailer: PHP/".phpversion();
$message = "Welcome to domain.com\n" .
"We see that you recently opened an account with us.\n" .
"Before you can start using our services you need to activate your account.\n" .
"Follow the link below to activate your account.\n" .
SITE_URL."user/activate/?e=" . $to . "&c=" . $code . "&action=activate\n\n" .
"_______________________\n\n" . "This is an automated response from ". SITE_NAME .
"\n\n" . "Please do not respond to this email.";
$send = mail($to, $subject, $message, $headers);
if($send){
return true;
}else{
return false;
}
}
this does work how i want it to... and its not differant
function sendEmail($to, $from, $subject, $message){
if(empty($to) OR !preg_match('/^([a-z0-9])(([-a-z0-9._])*([a-z0-9]))*\@([a-z0-9])*(\.([a-z0-9])([-a-z0-9_-])([a-z0-9])+)*$/i', $to)){
$this->m->addMessage("email-form", "error", "The recipients email must be in the form of email@domain.com.");
}
if(empty($from) OR !preg_match('/^([a-z0-9])(([-a-z0-9._])*([a-z0-9]))*\@([a-z0-9])*(\.([a-z0-9])([-a-z0-9_-])([a-z0-9])+)*$/i', $from)){
$this->m->addMessage("email-form", "error", "Your email must be the form of email@domain.com.");
}
if(empty($subject)){
$this->m->addMessage("email-form", "error", "You must include a subject.");
}
if(empty($message)){
$this->m->addMessage("email-form", "error", "You must include a message.");
}
if($this->m->countMessages() > 0){
//Stop
return FALSE;
}else{
//Continue
$save = mysql_query("/*query left empty on purpose (not my problem) */") or die(mysql_error());
if($save){
$headers = 'FROM: '.$from."\r\n".
'Reply-To: support@domain.com'."\r\n".
'X-Mailer: PHP/'.phpversion();
$send = mail($to, $subject, $message, $headers);
if($send){
$this->m->addMessage("email-form", "success", "Your message has been sent.");
return TRUE;
}else{
$this->m->addMessage("email-form", "error", "Your message could not be sent.");
return FALSE;
}
}else{
$this->m->addMessage("email-form", "error", "Your message could not be sent.");
return FALSE;
}
}