Smart Mailer PHP Support Product Page

In progress

Smart Mailer whit templates

Reported 17 Dec 2010 18:55:27
2
have this problem
17 Dec 2010 18:55:27 CALSINA RAFEL posted:
I’m using your Smart Mailer PHP extension in order to send multiple mailings through a recordset which contains name and e-mail for each receiver.
If the body of the email is a static text it works properly. However, when I try to send a web page template, it gives back the following error:

Warning: fopen() [function.fopen]: URL file-access is disabled in the server configuration in /var/www/vhost/eltroc.org/home/html/ScriptLibrary/incSmartMailer.php on line 156 Warning: fopen(www.eltroc.org/proves/mailings/prova.html) [function.fopen]: failed to open stream: no suitable wrapper could be found in /var/www/vhost/eltroc.org/home/html/ScriptLibrary/incSmartMailer.php on line 156 Error sending e-mail Could not open the URL to the template Please correct and try again


The former error appears in both configuration cases: typing in the setup tab data from the SMTP server and using Sendmail.
Supposing that the HTML template sending worked, would it be possible to send PHP pages including parameters?

Replies

Replied 22 Dec 2010 10:42:57
22 Dec 2010 10:42:57 Miroslav Zografski replied:
Hello Rafel,

I have send you a replay by mail but will post here a follow up:

QuoteHello Rafel,

First check if the directory of the template has a proper permissions set so it provides access to the template. Easier way is to call the template page in a browser. If that is not the issue contact your Hosting provider and ask if the fopen function is allowed.

Meanwhile, Themplate can be a php file and you can pass to it URL Parameters in order to filter a recordset there.


Regards,
Replied 27 Jun 2012 11:37:23
27 Jun 2012 11:37:23 Bernd Schmitt replied:
Easy patch: Open the file C:\Users\Your_Username\AppData\Roaming\Adobe\Dreamweaver CSX\de_DE\Configuration\Shared\DMXzone\Smart Mailer\PHP\incSmartMailer.php

Add the function:


// webschmitt 2012-06-27
// Falls allow_file_fopen auf OFF steht wird Curl benutzt
function fetchURL($url) {
	if (ini_get('allow_url_fopen')) {
		return file_get_contents($url);
	} elseif (function_exists('curl_init')) {
		$curlObj = curl_init($url);
		curl_setopt($curlObj, CURLOPT_RETURNTRANSFER, 1);
		curl_setopt($curlObj, CURLOPT_HEADER, 0);
		$content = curl_exec($curlObj);
		curl_close($curlObj);
		return $content;
	} else {
		//die('Error');
		return false;
	}
}


search for the line ini_set("allow_url_fopen", 1);

wrap the file handlin with a comment and add the line as follow:


/*
	ini_set("allow_url_fopen", 1);
	
    $handle = fopen ($body, "r");
    if (!$handle) {
      $this->error("open");
    }
    while (!feof($handle)) {
      $content .= fgets ($handle, 1024);
    }
    fclose ($handle);
*/
	
	// webschmitt 2012-06-27
	$tempFile = fetchURL($body);
	if($tempFile === false) $this->error("open"); else $content .= $tempFile;  unset($tempFile);
	//


If allow_url_fopen is disabled on the server, this script snipped is trying to use CURL or returns false: It works fine for me.
Replied 27 Jun 2012 11:41:24
27 Jun 2012 11:41:24 Bernd Schmitt replied:
Yepp, forgotten: After the changing and saving the file restart Dreamweaver. To get the new script, make a little change in the SmartMailer behavior, upload the incSmartMailer.php again.
Replied 27 Jun 2012 11:45:08
27 Jun 2012 11:45:08 Bernd Schmitt replied:
Were good, this would be implement in the next update, that the users not loose this.

Reply to this topic