mayfair Posted September 25, 2009 Share Posted September 25, 2009 Hello Guys Im trying to send a 'mock order' email to be imported into our database using its built-in web import process. Ive spent so long on this now and think im close to the point of cracking this, but im stuck on a few little things that are stopped me from being able to test this properly. When sending the email, I need to send it with a command at the beginning of the TO: field so that the database knows it's a web import email and to check/filter it before importing. I literally just need to send the email with the following appearing in the TO: field: $to = "GM-WEBIMPORT <[email protected]>" As it is, that never reaces the wi address. If i CC myself in on a copy, I can see that it is sent to me and GM-WEBIMPORT only - no email address on the end of it. Is there a certain syntax I need to follow to stop this from breaking at the space and send to the full address? Thanks in advance. Link to comment https://forums.phpfreaks.com/topic/175484-php-mail-syntax-problem/ Share on other sites More sharing options...
bothwell Posted September 25, 2009 Share Posted September 25, 2009 Try using the $headers option instead, so something like: ... $headers .= 'To: GM-WEBIMPORT <[email protected]>' . "\r\n"; $headers .= 'From: The Sender <[email protected]>' . "\r\n"; $headers .= 'Bcc: [email protected]' . "\r\n"; ... mail($to, $subject, $message, $headers); Link to comment https://forums.phpfreaks.com/topic/175484-php-mail-syntax-problem/#findComment-924704 Share on other sites More sharing options...
mayfair Posted September 25, 2009 Author Share Posted September 25, 2009 Hello bothwell, thanks for your input. Using the headers option gives me the following error: PHP Warning: mail() [function.mail]: "sendmail_from" not set in php.ini or custom "From:" header missing in E:\inetpub\wwwroot\company.com\html\new\content\payment.php on line 203 Link to comment https://forums.phpfreaks.com/topic/175484-php-mail-syntax-problem/#findComment-924707 Share on other sites More sharing options...
mayfair Posted September 25, 2009 Author Share Posted September 25, 2009 Scratch that, forgot to concatenate the strings. The email still seems to send ok, but again if I check my CC copy, it appears as though it has just been sent to "GM-WEBIMPORT". Surely this is a common task?! Link to comment https://forums.phpfreaks.com/topic/175484-php-mail-syntax-problem/#findComment-924712 Share on other sites More sharing options...
bothwell Posted September 25, 2009 Share Posted September 25, 2009 You'd think so, yer :/ Was your last attempt setting both $to = '[email protected]'; and $headers .= 'To: GM-WEBIMPORT <[email protected]>' . "\r\n"; in the script? Link to comment https://forums.phpfreaks.com/topic/175484-php-mail-syntax-problem/#findComment-924719 Share on other sites More sharing options...
mayfair Posted September 25, 2009 Author Share Posted September 25, 2009 Yes I tried that, still have the same problem. Actually, if I try sending it like that I get a 550: Delivery is not allowed to this address error unless I turn on sending from external to external accounts on my hmail server.. which I obviously don't want to do! Can't believe something so simple is stopping me after ive spent weeks writing the whole ordering system lol Link to comment https://forums.phpfreaks.com/topic/175484-php-mail-syntax-problem/#findComment-924731 Share on other sites More sharing options...
bothwell Posted September 26, 2009 Share Posted September 26, 2009 It is a bit strange. According to php.net the format you're trying to send in is perfectly valid. Have you tried it on a live email server at all? It might just be some sort of config issue with your hMailserver (I'm assuming you're using that in a dev enviro). Link to comment https://forums.phpfreaks.com/topic/175484-php-mail-syntax-problem/#findComment-925535 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.