sendmail:fixed the bug that maintype may be referenced before assigned a value