anchor.diff:      QEmail = #email_queue{id=Id,
                             recipient=Recipient,
                             email=Email,
  +                          retry_on=inc_timestamp(now(), 0),
                             pickled_context=z_context:pickle(Context)},
       QEmailTransFun = fun() -> mnesia:write(QEmail) end,
       {atomic, ok} = mnesia:transaction(QEmailTransFun),        
  -    case Email#email.queue of
  -        false -> spawn_send(Id, Recipient, Email, Context, State);
  -        true -> State
  +    case Email#email.queue orelse length(State#state.sending) > ?EMAIL_MAX_SENDING of
  +        true -> State;
  +        false -> spawn_send(Id, Recipient, Email, Context, State)
       end.
   
   
   spawn_send(Id, Recipient, Email, Context, State) ->
  +    case is_valid_email(Recipient) of
  +        true ->
  +            spawn_send_checked(Id, Recipient, Email, Context, State);
  +        false ->
  +            %% delete email from the queue and notify the system
  +            delete_emailq(Id),
  +            z_notifier:first({email_failed, Id, Recipient}, Context),
  +            LogEmail = #log_email{
  +                severity=?LOG_ERROR, 
  +                mailer_status=error,
  +                props=[{reason, illegal_address}],
  +                message_nr=Id,
  +                envelop_to=Email,
  +                to_id=proplists:get_value(recipient_id, Email#email.vars),
  +                from_id=z_acl:user(Context),
  +                content_id=proplists:get_value(id, Email#email.vars),
  +                other_id=proplists:get_value(list_id, Email#email.vars),
  +                message_template=Email#email.html_tpl
  +            },
  +            z_notifier:notify({log, LogEmail}, Context),
  +            State
  +    end.
  +
  +spawn_send_checked(Id, Recipient, Email, Context, State) ->
       F = fun() ->
               MessageId = message_id(Id, Context),
               VERP = "<"++bounce_email(MessageId, Context)++">",
  
positive.code:     MegaSec2 = MegaSec + Sec2 div 1000000,
      {MegaSec2, Sec3, MicroSec}.
  
  
  
  %% @doc Simple header encoding.
  
negative.code:                                             }}, Context),
                      %% delete email from the queue and notify the system
                      delete_emailq(Id),
                      z_notifier:first({email_failed, Id, Recipient}, Context);
                  Receipt when is_binary(Receipt) ->
                      z_notifier:notify({log, LogEmail#log_email{
                                                  severity=?LOG_INFO, 
  