Postfix Change Header From: outgoing mail using altermime
Biasanya From: header akan di isi oleh nilai dari settingan client masing2 user.
contoh: di thunderbird From: header akan di isi settingan dari Your Name:.
untuk email2 official From header bisa di paksakan supaya menggunakan nama user yg ada di database postfix user.
dengan bantuan altermime dan sedikit coding(c dan bash script).
altermime dapat di download disini:
Coding c (access mysql db):
fungsinya untuk query field “name” (nama lengkap email user) di database postfix
paste code ini di console editor.(vi atau pico)
#include #include #include #include main(int argc,char *argv[]) { MYSQL *conn; MYSQL_RES *res; MYSQL_ROW row; char *server = "localhost"; char *user = "user"; char *password = "password"; char *database = "db"; char strsql[512]; if(argc != 2) { printf("Usage: %s ’string query’\n", argv[0]); exit(EXIT_FAILURE); } snprintf(strsql, 512, "SELECT REPLACE(TRIM(name),’\n’,”) FROM mailbox WHERE username=TRIM(’%s’)", argv[1]); conn = mysql_init(NULL); /* Connect to database */ if (!mysql_real_connect(conn, server, user, password, database, 0, NULL, 0)) { fprintf(stderr, "%s\n", mysql_error(conn)); exit(EXIT_FAILURE); } /* send SQL query */ if (mysql_query(conn, strsql)) { fprintf(stderr, "%s\n", mysql_error(conn)); exit(EXIT_FAILURE); } res = mysql_use_result(conn); while ( (row = mysql_fetch_row(res)) != NULL ) printf("%s\n", row[0]); return(0); /* Release memory used to store results and close connection */ mysql_free_result(res); mysql_close(conn); }