Tuesday, December 29, 2015
How to rewrite outgoing email address in sendmail
We can edit the file below to rewrite outgoing email address.
/etc/mail/genericstable
Add the line below
youraccount [email protected]
regenerate the hash file
makemap -r hash genericstable.db < genericstable
You can also edit /etc/mail/aliases for local accout
Alias to your alias account
youraccount youaliasaccount
Or alias to your device
youraccount /dev/yourdevice
Remeber use newaliases to update the hash file
How to disable IPv6 in Postfix
If you send mail to gmail server without correct PTR records, you'll get the reject message below.
"message does not meet IPv6 sending guidelines regarding PTR records 550-5.7.1"
You may update PTR record, or disable IPv6 if you don't need it.
Edit main.cf
Update the value with ipv4 in this line "inet_protocols = all"
inet_protocols = ipv4
You might get another message "config variable inet_interfaces: host not found: [::1]"
Update the value with 127.0.0.1 in this line "inet_interfaces = 127.0.0.1, [::1]" will solve the problem.
"message does not meet IPv6 sending guidelines regarding PTR records 550-5.7.1"
You may update PTR record, or disable IPv6 if you don't need it.
Edit main.cf
Update the value with ipv4 in this line "inet_protocols = all"
inet_protocols = ipv4
You might get another message "config variable inet_interfaces: host not found: [::1]"
How to rewrite outgoing email address
When we call mail function by php on Linux , we can use postfix.
However, the sender will be always apache or www-data, since the system use default web user name as the sender name.
We can rewrite email of the sender by steps below.
Step 1
Check configuration in php.ini
[mail function]
; For Win32 only.
SMTP = localhost
; For Win32 only.
;sendmail_from = ***@yourdomain.com
; For Unix only. You may supply arguments as well (default: "sendmail -t -i").
;sendmail_path =\r
Step 2
Edit main.cf for postfix
vi /etc/postfix/main.cf
Step 3
Specify the generic map file in main.cf
smtp_generic_maps = hash:/etc/postfix/generic
Step 4
Edit generic file
vi /etc/postfix/generic
Step 5
[email protected] [email protected]
Step 6
Create postfix db hash file
postmap /etc/postfix/generic
Step 7
Restart postfix
/etc/init.d/postfix restart
You will need use sender_canonical_maps = hash:/etc/postfix/canonical instead if your postfix is earlier version.
However, the sender will be always apache or www-data, since the system use default web user name as the sender name.
We can rewrite email of the sender by steps below.
Step 1
Check configuration in php.ini
[mail function]
; For Win32 only.
SMTP = localhost
; For Win32 only.
;sendmail_from = ***@yourdomain.com
; For Unix only. You may supply arguments as well (default: "sendmail -t -i").
;sendmail_path =\r
Step 2
Edit main.cf for postfix
vi /etc/postfix/main.cf
Step 3
Specify the generic map file in main.cf
Step 4
Edit generic file
vi /etc/postfix/generic
Step 5
Specify the mapping address
[email protected] [email protected]
Step 6
postmap /etc/postfix/generic
Step 7
Restart postfix
/etc/init.d/postfix restart
You will need use sender_canonical_maps = hash:/etc/postfix/canonical instead if your postfix is earlier version.
Wednesday, September 9, 2015
How to check array in jQuery
var dataarray = ["1", "2", "3"];
if ( $.inArray('1', dataarray) > -1 ) {
alert("checked");
}
How to clone a git branch
Create a new local branch develop and clone from remote branch origin/develop
git checkout -b develop origin/develop
How to list branches
list local branch
git branch
List remote branch
git branch -r
List all branch
git branch -a
How to switch between branch master and develop
git checkout master
git checkout develop
How to copy files/dictionaries from branch develop
git checkout develop files/*
Monday, August 24, 2015
How to remove function from a jQuery object
The function can be removed from a previously-attached event handler.
eg. Remove submit function from a form element.
$('form[name="formname"]').unbind('submit');
Tuesday, July 28, 2015
git problem : You are in the middle of a conflicted merge
Fix merge conflicts
git reset --hard HEAD
git fetch origin
git reset --hard origin
git reset --hard HEAD
git fetch origin
git reset --hard origin
Thursday, July 23, 2015
How to Stop Your Mac Book Pro From Freezing with Keyboard & Trackpad Unresponsive
If you can still toggle caps lock and it dones't freeze in safe mode, you can backup and remove the directory below.
/System/Library/Extenstions/AppleIntelHD5000Graphics.kext
Tuesday, March 24, 2015
How to use Replace & ReplaceAll in Java
Replace character
String newstring = str1.replace("-",",");
Replace string
String newstring = str1.replaceAll("[a-z]","0");
Replace string only for first match
String newstring = str1.replaceFirst("[a-z]","0");
String newstring = str1.replace("-",",");
Replace string
Replace string only for first match
String newstring = str1.replaceFirst("[a-z]","0");
Subscribe to:
Posts (Atom)