Skip to content

Instantly share code, notes, and snippets.

@ShiroKappa
Created July 23, 2012 15:44
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ShiroKappa/3164312 to your computer and use it in GitHub Desktop.
Save ShiroKappa/3164312 to your computer and use it in GitHub Desktop.
ご送信防止秀丸メールマクロ
// HMCheckToCC.mac
// 2006/03/23
loaddll "tkinfo.dll";
if (dllfunc("IsTuruKameMain")) {
message "このマクロは本体側では実行できません。";
endmacro;
}
$selfDomain = "gamil.com";
#errorFlag = 0;
$messageBox = "";
$searchString[0] = "To";
$searchString[1] = "Cc";
#searchStringNum = 2;
#i1 = 0;
#i2 = 0;
#i3 = 0;
#i4 = 0;
#i5 = 0;
#j1 = #searchStringNum;
#j2 = 0;
#j3 = 0;
#j4 = 0;
#j5 = 0;
$s1 = "";
$s2 = "";
$s3 = "";
while (#i1 < #j1) {
#i2 = 0;
#j2 = 0;
#j2 = dllfunc("CountCurrentHeader",$searchString[#i1]);
while (#i2 < #j2) {
$s1 = "";
$s1 = dllfuncstr("CurrentHeader2",$searchString[#i1],#i2);
#i3 = 0;
#j3 = 0;
#j3 = dllfunc("CountEmailList",$s1);
while (#i3 < #j3) {
#j4 = 0;
$s2 = dllfuncstr("GetEmailList",$s1,#i3);
$mailList[#i4] = dllfuncstr("SetEmailOnly",$s2);
#j4 = strstr($mailList[#i4],"@");
if (#j4 < 1) {
#errorFlag = 1;
} else {
$s3 = rightstr($mailList[#i4],strlen($mailList[#i4]) - #j4 - 1);
if ($s3 == $selfDomain) {
goto Skip;
}
#i5 = 0;
while (#i5 < #j5) {
if ($domainList[#i5] == $s3) {
goto Skip;
}
#i5 = #i5 + 1;
}
$domainList[#j5] = $s3;
#j5 = #j5 + 1;
Skip:
}
#i4 = #i4 + 1;
#i3 = #i3 + 1;
}
#i2 = #i2 + 1;
}
#i1 = #i1 + 1;
}
if (#errorFlag == 1) {
message "無効なアドレスが含まれています。";
#m = dllfunc("SetCancel",1);
endmacro;
}
#i = 0;
while (#i < #i4) {
$messageBox = $messageBox + $mailList[#i] + "\n";
#i = #i + 1;
}
#flag = dllfunc("Bypass_MessageBox",hidemaruhandle(0),$messageBox+"に送信してよろしいですか","宛先の確認",0x124);
if (#flag == 7) {
#m = dllfunc("SetCancel",1);
endmacro;
}
if (#j5 > 1) {
$messageBox = $selfDomain + "以外の\n";
$messageBox = $messageBox + str(#j5) + "個のドメインがあて先に登録されています。\n\n***内訳***\n";
#i = 0;
while (#i < #j5) {
$messageBox = $messageBox + $domainList[#i] + "\n";
#i = #i + 1;
}
#flag = dllfunc("Bypass_MessageBox",hidemaruhandle(0),$messageBox+"送信してよろしいですか","ドメインの確認",0x124);
if (#flag == 7) {
#m = dllfunc("SetCancel",1);
endmacro;
}
}
endmacro;
@dminer
Copy link

dminer commented Mar 21, 2013

Thanks a lot!
It would be Good macro to avoid fatal trouble.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment