After testing some more i found out that there is a strange phenomena.
Whe i send two mails after each other the FROM adress is not set properly in the second mail.
so
$firstmail = $modx->getService('mail', 'mail.modSwiftMailer');
$firstmail->address('from', '[email protected]', 'Me');
$firstmail->address('sender','[email protected]', 'Me');
$firstmail->address('to', '[email protected]', 'You');
$firstmail->subject(subject1);
$body ='hello there';
$firstmail->body($body, 'text/plain');
$firstmail->send();
// now sent the second mail
$secondmail = $modx->getService('mail', 'mail.modSwiftMailer');
$secondmail->address('from', '[email protected]', 'Me');
$secondmail->address('sender','[email protected]', 'Me');
$secondmail->address('to', '[email protected]', 'You');
$secondmail->subject(subject1);
$body ='hello there';
$secondmail->body($body, 'text/plain');
$secondmail->send();
Now you'll see both mails in your mailbox and BOTH mails af the from address of the first mail.
the second mail should have
[email protected] in the from field.Instead it has
the FROMaddress of the firstmail