<meta http-equiv=“expires“ value=“Thu, 16 Mar 2000 11:00:00 GMT“ />
<meta http-equiv=“pragma“ content=“no-cache“ />
<meta http-equiv=“expires“ value=“Thu, 16 Mar 2000 11:00:00 GMT“ />
<meta http-equiv=“pragma“ content=“no-cache“ />
This function can be used for oppenign of popup window with content in it
function openwin(txt){
var previewWnd = window.open('','embed_preview','width=500,height=400,scrollbars=1,status=0,location=0,directories=0,');
previewWnd.document.body.innerHTML = txt.replace(/\n/g,"
");
previewWnd.focus();
}
Sometimes is very hard to debug from which virtual host spam is
This can be check very easy with this trick
create a new file
vim /usr/local/bin/phpsendmail
place inside it
#!/usr/bin/php
<?php
$sendmail = ‘/usr/sbin/sendmail’;
$logfile = ‘/var/log/mail.form’;
/* Get email content */
$logline = “;
$mail = “;
$fp = fopen(‘php://stdin’, ‘r’);
while ($line = fgets($fp))
{
if(preg_match(‘/^to:/i’, $line) || preg_match(‘/^from:/i’, $line))
{
$logline .= trim($line).’ ‘;
}
$mail .= $line;
}
/* Build sendmail command */
$cmd = ‘echo ‘ . escapeshellarg($mail) . ‘ | ‘.$sendmail.’ -t -i’;
for ($i = 1; $i < $_SERVER[‘argc’]; $i++)
{
$cmd .= escapeshellarg($_SERVER[‘argv’][$i]).’ ‘;
}
/* Log line */
$path = isset($_ENV[‘PWD’]) ? $_ENV[‘PWD’] : $_SERVER[‘PWD’];
file_put_contents($logfile, date(‘Y-m-d H:i:s’) . ‘ ‘ . $logline .’ ==> ‘ .$path.“\n“, FILE_APPEND);
/* Call sendmail */
return shell_exec($cmd);
?>
Then you need to make it executable
chmod +x /usr/local/bin/phpsendmail
touch /var/log/mail.form
chmod a+w /var/log/mail.form
In your php.ini file you need to add
sendmail_path = /usr/local/bin/phpsendmail
Restart apache
This will cause all emails which are send from apache to be logged in the file /var/log/mail.form
If you get some errors like this you need to open your home directory
vim ~/.my.cnf
and change on the row
pass=
to
password=
This is a guide to installing OpenDKIM for multiple domains on a Postfix-installtion on Debian. I tried some other guides but kept running into problems, so this is how I did it.
Among others, Google Gmail and Yahoo mail check your email for a DKIM signature.
Install and Configure OpenDKIM
1. Install OpenDKIM
apt-get install opendkim
Comment: This will install the latest available stable Debian packaged version of OpenDKIM which is currently 2.0.1. This version is already a couple of years old (2010).
If you know how/want to compile sources yourself, then the latest version is 2.4.3 (and 2.5.0 is right around the corner)
2. Edit the OpenDKIM config file
vim /etc/opendkim.conf
Add these rows:
KeyTable /etc/opendkim/KeyTable
SigningTable /etc/opendkim/SigningTable
ExternalIgnoreList /etc/opendkim/TrustedHosts
InternalHosts /etc/opendkim/TrustedHosts
Note: If you run multiple instances of Postfix you need to add this to the opendkim.conf for each instance (or the ones you want to use opendkim)
3. Edit /etc/opendkim/TrustedHosts
mkdir -p /etc/opendkim/
vim /etc/opendkim/TrustedHosts
Add domains, hostnames and/or ip’s that should be handled by OpenDKIM. Don’t forget localhost.
127.0.0.1
localhost
4. Edit /etc/default/opendkim
vim /etc/default/opendkim
Uncomment this row:
SOCKET=“inet:12345@localhost“ # listen on loopback on port 12345
Generate keys
Repeat these steps to generate keys for each domain you will send email from. Replace mydomain.com with your domain name in examples below.
1. Generate key
mkdir -p /etc/opendkim/keys/mydomain.com
cd /etc/opendkim/keys/mydomain.com
opendkim-genkey -r -d mydomain.com
chown opendkim:opendkim default.private
2. Add domain to KeyTable /etc/opendkim/KeyTable
vim /etc/opendkim/KeyTable
Add line
default._domainkey.mydomain.com mydomain.com:default:/etc/opendkim/keys/mydomain.com/default.private
3. Add domain to SigningTable /etc/opendkim/SigningTable
vim /etc/opendkim/SigningTable
Add line:
mydomain.com default._domainkey.mydomain.com
Note that in OpenDKIM 2.0.1 domain names are case sensitive (supposed to be fixed from 2.3.1 but I have not tested).
This means that in the above example an email from info@mydomain.com will be signed, but an email from info@MyDomain.com will not be signed. The workaround is to add one extra entry for MyDomain.com to SigningTable.
4. Add to DKIM public key to DNS
Add an entry for the public key to the DNS server you are using for your domain. You find the public key here:
cat /etc/opendkim/keys/mydomain.com/default.txt
And insert it in your zone file
Start OpenDKIM
/etc/init.d/opendkim start
In the future, if you make any changes to configuration remember to restart: /etc/init.d/opendkim restart
Configure and Restart Postifx
1. Configure Postfix
vim /etc/postfix/main.cf
Add or edit these lines:
milter_default_action = accept
milter_protocol = 6
smtpd_milters = inet:localhost:12345
non_smtpd_milters = inet:localhost:12345
2. Restart Postfix
/etc/init.d/postfix reload
Log files are in the /var/log directory
cat /var/log/mail.log
cat /var/log/mail.warn
cat /var/log/mail.err
Log more info
vim /etc/opendkim.conf
Add this line:
LogWhy yes
Credits
Guides that have helped me along the way: Debian Tutorials and Syslog