sendmail QuickSendMail function
Return to Introduction  Previous page  Next page

function SendMail(const FromAddr, FromName, ToAddr, ToName, Subject, Body: String;  
  const SMTPHost: String = 'localhost'; SMTPPort: Word = 25;  
  ContentType: TSMTPContentType = ctHTML; Priority: TSMTPPriority = mpNormal;  
  const ContentCharset: String = 'iso-8859-1'; RunInSeparateThread: Boolean = True): Boolean;  

The QuickSendMail function is alternative way to send email messages without having the SendMail component on the form, and without dynamic creation of SendMail component instances. When you use this function — everything created/released internally.  
The QuickSendMail have following set of parameters (some of parameters are optional and may be not specified):  
FromAddrspecifies the email address of sender;  
FromNamespecifies the name of sender (the name which displayed in email message, can be empty string);  
ToAddremail address of recipient;  
ToNamename of recipient (can be empty string);  
Subjectthe subject of email message;  
Bodythe text of email message (can contain HTML tags if ContentType is ctHTML, or just plain text if ContentType is ctPlainText);  
SMTPHostthe hostname or IP address of SMTP server;  
SMTPPortthe port number of SMTP server (standard port for SMTP servers is 25);  
ContentTypecan be ctPlainText if your email message contains just plain text, or ctHTML if it should be HTML-formatted;  
Prioritypriority of email message (npNormal by default);  
ContentCharsetthe set of characters of text in email message. Use appropriate definition of charset for language used in email message;  
RunInSeparateThreadspecifies whether the message should be prepared and sent via Internet to SMTP server in current, caller's thread, or should create separate thread which will process the message delivery. Set this parameter to True to create separate thread, or to False if the part of code which calls the QuickSendMail function are already in separate, non-interface thread.  

See also
SendMail component.