Ich habe dann einfach weiter geforscht und nachdem ich weder mit `\ifx`, `ifthenelse` oder einfach nur `if` weiter kam, stieß ich bei Stackexchange auf den wesentlichen Punkt: **Der Adressbereich von `\begin{letter}` verträgt sich nicht mit u.a. `\ifthenelse`.**<sup>[1](https://tex.stackexchange.com/questions/192669/mail-merge-using-datatool-with-letter-class)</sup> Auch wenn mir die Information an sich noch nicht weiterhilft und ich keine Ahnung habe warum die bisher nachweislich mehr als 100 Briefe kein Problem waren, war dort immerhin ein Workaround dabei; nicht schön, aber funktioniert.
Hier die Lösung (neues `\makeaddress` anstatt `\begin{letter}`) bei mir angewendet:
%example data
\begin{filecontents*}%
%~ [overwrite] % good to know it exists, but not needed here
{data.csv} Memberno;Mark;Nick;EMail;PGP;Firm;Title;FirstNames;FamilyNames;Phone;PostalNames;AddressDetails;Street;HouseNumber;ZIP;Place;Country
1;m;Sandy;sandy@strahlenau.de;;;;Sandy;Sonnenschein;;Sandra Sunshine;;Wetterstraße;5;11111;Strahlenau;
2;m;York;york@gmail.com;0x12345678;NoGo GbR;Dr.;York;Quietsch;;;;Bachstraße;4;67345;Ententeich;Österreich
3;p;Sab;sab@gmx.net;0xabcdef;;;Sabine;Müller;;;;Kutscherstraße;19;39114;Sonstwo;
4;m;Jane;jane@1und1.de;;;;Hannah;Geisler;;;;Hauptstraße;44 a;1789;Sity;Schweiz
\end{filecontents*}
\documentclass[
fontsize=11pt,
paper=a4,
parskip=full,
enlargefirstpage=on, % More space on first page
fromalign=left, % PLacement of name in letter head
fromphone=false,
fromfax=false,
fromrule=aftername, % Rule after sender name in letter head
fromemail=on, % turn on email of sender
fromurl=on,
addrfield=on, % Adress field for envelope with window
backaddress=on, % Sender address in this window
%~ subject=beforeopening, % Placement of subject
locfield=narrow, % Additional field for sender
foldmarks=on, % Print foldmarks
version=last,
pagenumber=off,
subject=untitled,
ngerman, % modern german orthography
]{scrlttr2}
]{scrartcl}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{babel}
\usepackage{scrletter}
\nonfrenchspacing
\setkomavar{fromzipcode}{12345}
\setkomavar{place}{Place}
\setkomavar{date}{%
\today%
}
\setkomavar{fromemail}[]{mail@sender.com}
\setkomavar{fromurl}[]{https://domain.sender.com/}
\LoadLetterOption{DIN}
\setkomavar{fromname}{SENDER Company}
\setkomavar{toname}{RECEIPIENT}
\setkomavar{fromaddress}{%
Streetaddress \\
\usekomavar{fromzipcode}~\usekomavar{place}
}
\setkomavar{backaddressseparator}{\enspace-\enspace}
\setkomavar{enclseparator}[Attachments]{: }
\usepackage[utf8,separator=;]{datatool}
\DTLsetseparator{;}
\DTLloadrawdb[
keys={%
fieldmemberno,fieldmark,fieldnick,fieldemail,fieldpgp,fieldfirm,fieldtitle,fieldname1,fieldname2,fieldphone,fieldnamepostal,fieldremark,fieldstreet,fieldhousenr,fieldzip,fieldplace,fieldcountry %
}
]%
{addresses}%
{data.csv}
\renewcommand*{\raggedsignature}{\raggedright}
\setkomavar{signature}{boardmembers}
% found at https://tex.stackexchange.com/questions/192669/mail-merge-using-datatool-with-letter-class
% The argument to \begin{letter} is massaged in order to extract the addressee. This massage is incompatible with \ifthenelse.
\makeatletter
\newtoks\address@toks
\newcommand\addto@address[1]{%
\address@toks=\expandafter{\the\expandafter\address@toks#1}%
}
\newcommand\makeaddress{%
\address@toks={}%
\ifthenelse{\DTLiseq{\addrFirm}{}}{}{\addto@address{\addrFirm\\}}
\ifthenelse{\DTLiseq{\addrTitle}{}}{}{\addto@address{\addrTitle\ }}%
\ifthenelse{\DTLiseq{\addrPostname}{}}{\addto@address{\addrFirstname\ \addrSurname\\}}{\addto@address{\addrPostname\\}}
\ifthenelse{\DTLiseq{\addrRemark}{}}{}{\addto@address{\addrRemark\\}}
\ifthenelse{\DTLiseq{\addrStreet}{}}{}{\addto@address{\addrStreet}}
\ifthenelse{\DTLiseq{\addrHouseNr}{}}{}{\addto@address{\ \addrHouseNr}}
\addto@address{\noexpand\\}
\ifthenelse{\DTLiseq{\addrZIP}{}}{}{\addto@address{\addrZIP\ }}
\ifthenelse{\DTLiseq{\addrPlace}{}}{}{\addto@address{\addrPlace}}
%~ \ifthenelse{\DTLiseq{\addrState}{}}{}{, \addto@address{\addrState}}
\ifthenelse{\DTLiseq{\addrCountry}{}}{}{\addto@address{\\\addrCountry}}
\begingroup
\edef\x{\endgroup\noexpand\begin{letter}{\the\address@toks}}\x
}
\makeatother
\begin{document}
\DTLforeach*{addresses}{%
\Chiffre=fieldmemberno,\Mark=fieldmark,\MemberNick=fieldnick,\MemberEMail=fieldemail,\PGP=fieldpgp,%
\addrFirm=fieldfirm,\addrTitle=fieldtitle,%
\addrFirstname=fieldname1,\addrSurname=fieldname2,%
\Phone=fieldphone,%
\addrRemark=fieldremark,\addrPostname=fieldnamepostal,
\addrStreet=fieldstreet,\addrHouseNr=fieldhousenr,\addrZIP=fieldzip,\addrPlace=fieldplace,\addrCountry=fieldcountry
}{
\ifstr{\Mark}{m}{
\setkomavar{title}{Your Membership at \usekomavar{fromname}}
\setkomavar{subject}{}
% begin letter
\makeaddress
\opening{Hello \MemberNick{}!}
Letting you know some detail about your mebership at \usekomavar{fromname}\\
Chiffre: \Chiffre{} (please mention when contacting)
Nick: \MemberNick{}
E-Mail: \MemberEMail{}
\closing{Yours,}
\end{letter}\newpage
}{}
}
\end{document}
Hier nun auch nicht mehr `scrlttr2` als Klasse, da jemand meinte das wäre nicht gut bzw. Zukunftssicher.
Falls noch jemand Verbesserungsvorschläge hat, immer gerne :)