|
ならば、こんな風にしたらいいかと思います。
loaddll "tkinfo.dll";
if( dllfunc("MailType") != 2 ) {
endmacro;
}
call RetrieveRootEmail, "To";
$root = $$return;
call RetrieveRootEmail, "Cc";
$root = $root + $$return;
call CheckEmail, "To";
call CheckEmail, "Cc";
if( $bcc != "" ) {
#n = dllfunc("AddHeader", "Bcc:", $bcc );
}
endmacro;
CheckEmail:
##c = dllfunc("CountCurrentHeader", $$1);
##i = 0;
while( ##i < ##c ) {
$$to = dllfuncstr("CurrentHeader2", $$1, ##i);
##iEmail = 0;
##cEmail = dllfunc("CountEmailList", $$to);
while( ##iEmail < ##cEmail ) {
$$one = dllfuncstr("GetEmailList", $$to, ##iEmail );
$$email = dllfuncstr("SetEmailOnly", $$one );
if( $$email != "" ) {
if( strstr( $root, "{" + $$email + "}" ) >= 0 ) {
question "同じ人に転送しようとしています。\n"
+ "メールアドレス = " + $$email + "\n\n"
+ "この人を宛先から除去しますか?";
if( result == yes ) {
if( $bcc == "" ) {
$bcc = $$one;
} else {
$bcc = $bcc + ", " + $$one;
}
call DeleteEmail $$1, ##i, $$one;
}
}
}
##iEmail = ##iEmail + 1;
}
##i = ##i + 1;
}
return;
DeleteEmail:
$$to = dllfuncstr("CurrentHeader2", $$1, ##2);
##x = strstr( $$to, $$3 );
if( ##x >= 0 ) {
$$to1 = leftstr( $$to, ##x );
$$to2 = midstr( $$to, ##x + strlen($$3), 9999);
while( leftstr( $$to2, 1 ) == " " ) {
$$to2 = midstr( $$to2, 1, 9999);
}
if( leftstr( $$to2, 1 ) == "," ) {
$$to2 = midstr( $$to2, 1, 9999);
}
while( leftstr( $$to2, 1 ) == " " ) {
$$to2 = midstr( $$to2, 1, 9999);
}
$$to = $$to1 + $$to2;
while( rightstr( $$to, 1 ) == " " ) {
$$to = leftstr( $$to, strlen($$to) - 1 );
}
if( rightstr( $$to, 1 ) == "," ) {
$$to = leftstr( $$to, strlen($$to) - 1 );
}
while( rightstr( $$to, 1 ) == " " ) {
$$to = leftstr( $$to, strlen($$to) - 1 );
}
##n = dllfunc("SetHeader2", $$1, $$to, ##2);
}
return;
RetrieveRootEmail:
##c = dllfunc("CountRootHeader", $$1);
##i = 0;
while( ##i < ##c ) {
$$to = dllfuncstr("RootHeader2", $$1, ##i);
##iEmail = 0;
##cEmail = dllfunc("CountEmailList", $$to);
while( ##iEmail < ##cEmail ) {
$$email = dllfuncstr("GetEmailList", $$to, ##iEmail );
$$email = dllfuncstr("SetEmailOnly", $$email );
if( $$email != "" ) {
$$ret = $$ret + "{" + $$email + "}";
}
##iEmail = ##iEmail + 1;
}
##i = ##i + 1;
}
return $$ret;
|
|