weeder Posted March 12, 2010 Share Posted March 12, 2010 My host has don't allow phpmail and need help converting this small script to smtp If anyone can help please // Config $modEnabled = true; $subMailConfig = array( // What email do you want the emails to appear from? 'from' => '[email protected]', // What name do you want the emails to appear from? e.g. MySite Staff 'from_name' => 'MySite', // What subject would you like to show? 'subject' => 'Submissions Accepted at MySite!', // The message you would like to send // {sname} = Site name of the submitter // {downloads} = List of inserted downloads // {surl} = Site URL of the submitter // {email} = Email of the submitter // The above tags are replaced automatically with their equivalents // Do not place whitespace before any lines after the first as the email will show it and look untidy 'message' => "{sname}, Your downloads were successfully submitted to MySite.com and have now been placed in the queue for further inspection before being listed publicly. Please allow upto 3 days for this process to be completed as we have a large amount of downloads to deal with. The following downloads were recieved: {downloads} If some downloads are missing, they were excluded automatically due to being invalid. If you see no downloads above then we recommend you re-submit as our system has faced problems during the submission process. MySite.com Staff" ); function subMail($inserted) { global $subMailConfig; $site = $inserted['details']; $items = $inserted['downloads']; $msgDownloads = ""; foreach($items as $item) $msgDownloads .= $item['title'].' ('.$item['url'].')'."\n"; $msg = str_replace( array( '{sname}', '{surl}', '{email}', '{downloads}' ), array( $site['sname'], $site['surl'], $site['email'], $msgDownloads ), $subMailConfig['message'] ); mail($site['email'],$subMailConfig['subject'],$msg,"From: ".$subMailConfig['from_name']." <".$subMailConfig['from'].">"); // Return the original array just for the hell of it return $inserted; } if($modEnabled) $core->attachDataHook("submitSuccess","subMail"); ?> Many thanks in advance Link to comment https://forums.phpfreaks.com/topic/194997-convert-to-smtp/ Share on other sites More sharing options...
trq Posted March 12, 2010 Share Posted March 12, 2010 Firstly, all email uses the smtp protocol so your post makes little sense. Secondly, your have failed to tell us where your stuck. Were not here to simply write code for people, what is it you are asking exactly? Link to comment https://forums.phpfreaks.com/topic/194997-convert-to-smtp/#findComment-1025147 Share on other sites More sharing options...
weeder Posted March 12, 2010 Author Share Posted March 12, 2010 ok the above scipt uses phpmail() which isn't available and workes fine on phpmail() I only smtp mail on hosting and i tried to convert the above to work but what ever i try fails A few pointer if nothing else will help to get the above working using smtp and not phpmail() Link to comment https://forums.phpfreaks.com/topic/194997-convert-to-smtp/#findComment-1025329 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.