|
っと書いた所ですが、無理矢理To:ヘッダを見て動くマクロにしてみました。ただ、ちゃんと動くかどうかは怪しいです。
ダメモトで試していただくといいかもしれません。
-----------------------------------------------------------------------------------------
#n = dllfunc("LoadAccountProp", dllfuncstr("CurrentAccount"));
$alias = dllfuncstr("GetAccountProp", "szEmailAlias");
if( $alias == "" ) {
message "このマクロを実行するには「アカウント毎の設定・個人情報・詳細」の「自分用メールアドレスの別名」にご自身のセーフティーアドレスを登録してください。";
endmacro;
}
if( dllfunc("MailType") == 6 ) { //添付ファイルとして転送の場合
$attach = dllfuncstr("HomeDir") + dllfuncstr("CurrentAccount") + "\\" + dllfuncstr("CurrentHeader", "X-Attach");
$text = dllfuncstr("LoadStringFromFile", $attach );
if( strlen($text) > 0 ) {
$text = dllfuncstr("ToLower", $text);
#to = strstr( $text, "\nto:" );
if( #to != 0 ) {
$text = midstr( $text, #to + 4 );
#end = strstr( $text, "\n" );
if( #end > 0 ) {
$text = leftstr( $text, #end );
}
#x = strstr( $text, $alias );
if( #x >= 0 ) {
//別名が見つかった場合
$name = dllfuncstr("SetNameOnly", dllfuncstr("CurrentHeader", "From"));
if( $name == "" ) {
$from = $alias;
} else {
$from = $name + " <" + $alias + ">";
}
#n = dllfunc("SetHeader", "From", $from);
}
}
}
endmacro;
}
$alias = "," + dllfuncstr("GetAccountProp", "szEmail") + "," + $alias + ","; //自分自身のメールアドレスを前後にコンマが入る形の文字列にする。
$alias = dllfuncstr("ToLower", $alias);
$to = dllfuncstr("RootHeaderUnited", "To") + "," + dllfuncstr("RootHeaderUnited", "Cc");
$to = dllfuncstr("ToLower", $to);
if( $to == "," ) {
//返信メールでも転送メールでも無い場合
//message "返信メールでも転送メールでも無い";
endmacro;
}
#count = dllfunc("CountEmailList", $to);
while( #i < #count ) {
$one = dllfuncstr("GetEmailList", $to, #i);
$one = dllfuncstr("SetEmailOnly", $one);
$one = "," + $one + ",";
#x = strstr( $alias, $one );
if( #x >= 0 ) {
if( #x == 0 ) {
//メインのメールアドレスなら何もしない。
//message "メインのメールアドレス";
} else {
//message "From:ヘッダ書き換え";
$hit = midstr( $alias, #x + 1 );
$hit = leftstr( $hit, strstr( $hit, "," ) );
$name = dllfuncstr("SetNameOnly", dllfuncstr("CurrentHeader", "From"));
if( $name == "" ) {
$from = $hit;
} else {
$from = $name + " <" + $hit + ">";
}
#n = dllfunc("SetHeader", "From", $from);
}
endmacro;
}
#i = #i + 1;
}
//message "自分のメールアドレス見つからず。";
|
|