Jump to content

convert to smtp


weeder

Recommended Posts

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.