unemployment Posted August 1, 2011 Share Posted August 1, 2011 My mail function is failing a I don't know why. I have tested it on my index and it seems to work, but not on my sign up. <?php $invbody = <<<EMAIL Hello <[fname]>, You've registered and need to activate your account. Click the link below or paste it into the URL bar of your web browser. http://mysite.com/activate.php?id=<[id]>&code=<[code]> Thanks! Team EMAIL; $u_info = fetch_user_info_reg($id); $invbody = str_replace(array('<[fname]>', '<[id]>', '<[code]>'), array($u_info['firstname'], $u_info['id'], $u_info['code']), $invbody); mail($u_info['email'], 'Activate Your Account', $invbody, 'From: [email protected]'); ?> Here is the pre of $u_info Array ( [0] => Array ( [id] => 67 [firstname] => fgsgs [email] => [email protected] [code] => 13059599 ) ) Link to comment https://forums.phpfreaks.com/topic/243499-mail-function-fails/ Share on other sites More sharing options...
WebStyles Posted August 1, 2011 Share Posted August 1, 2011 what setup do you have? (i.e. linux, windows ?) probably smtp not set up correctly. Link to comment https://forums.phpfreaks.com/topic/243499-mail-function-fails/#findComment-1250285 Share on other sites More sharing options...
unemployment Posted August 1, 2011 Author Share Posted August 1, 2011 what setup do you have? (i.e. linux, windows ?) probably smtp not set up correctly. Linux and it is set up correctly. It works when I use the mail function on my index.php Does the email variable have to be defined as a string or something? Link to comment https://forums.phpfreaks.com/topic/243499-mail-function-fails/#findComment-1250300 Share on other sites More sharing options...
the182guy Posted August 1, 2011 Share Posted August 1, 2011 Here is the pre of $u_info Array ( [0] => Array ( [id] => 67 [firstname] => fgsgs [email] => [email protected] [code] => 13059599 ) ) If that's correct then the email address is located at $u_info[0]['email'] not $u_info['email'] Link to comment https://forums.phpfreaks.com/topic/243499-mail-function-fails/#findComment-1250308 Share on other sites More sharing options...
unemployment Posted August 1, 2011 Author Share Posted August 1, 2011 Good catch. My array structure wasn't correct. Thanks for the find! Link to comment https://forums.phpfreaks.com/topic/243499-mail-function-fails/#findComment-1250310 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.