How To Send An E-mail By Code

CK CK 3788 
Created at
Updated at  
1,116 0 0

Use this function to send an e-mail through your program. You must have the component TNMSMTP from FastNet tools. 
This component is included in Delphi 4-5 Professional and Enterprise

 

procedure TForm1.Button1Click(Sender: TObject); 
begin 
  NMSMTP1.Host := 'mail.host.com'; 
  NMSMTP1.UserID := 'username'; 
  NMSMTP1.Connect; 

  NMSMTP1.PostMessage.FromAddress := 'webmaster@swissdelphicenter.ch'; 
  NMSMTP1.PostMessage.ToAddress.Text := 'user@host.com'; 
  NMSMTP1.PostMessage.Body.Text := 'This is the message'; 
  NMSMTP1.PostMessage.Subject := 'Mail subject'; 
  NMSMTP1.SendMail; 
  showmessage('Mail sent !'); 
end;


 

Tags SMTP SendMail TNMSMTP Facebook X
Comments 0
Similar posts
  1. Send Email Using C#
    1,378
  2. Send An Email Using A Bean
    1,015
  3. How to send email in PHP ?
    894
  4. How to send email by TIdSMTP VCL ?
    1,019
  5. Set up an SMTP server on CentOS 7
    727
  6. Bash script to install postfix and sasl for sending email
    1,197
  7. Gmail requires all senders to authenticate with either SPF or DKIM.
    681
  8. Why SPF and DKIM Are Essential for Linux Email Servers?
    36
  1. Browse for Computers, Folders, Files and Printers
    571
  2. How to draw Transparent Text on bitmap
    386
  3. How Do I Remove The Application Icon From The Taskbar?
    1,099
  4. How To Show The Print Dialog And Print Text Files
    1,295
  5. How To Make An Animated Application Icon
    822
  6. How To Pass The Focus To The Next/prior Control
    1,210
  7. How To Make Rounded Windows
    1,227
  8. How To Get Windows Uptime
    1,479
  9. How To Find Out Total And Available Memory
    1,642
  10. How To Change The System Time
    1,254
  11. How To Get The Windows OS Version
    618
  12. How To Change The Desktop Wallpaper
    2,153
  13. How To Get The Windows Language
    1,147
  14. How To Make A Gradient Filled Form
    840
  15. How can I hide the caption bar on a form?
    1,398
  16. How To Open Url In Default Webbrowser
    460
  17. How To Check If A Soundcard Is Installed
    1,563
  18. How To Change Screen Resolution
    2,075
  19. How To Force The Correct Decimal Separator
    1,778
  20. How To Register Own File Types
    1,192
  21. How To Get Volume Name
    411
  22. How To Get Windows And System Directory
    2,702
  23. Get The Drive Type
    498
  24. How can I modify aliases programmatically ?
    1,306
  25. Setting TQuery SQL Statement
    12,158
Recently updated
  1. Why 100% SEO Guarantees Better User Engagement and How to Achieve It in Your Service
    42
  2. How do I create animated background for Google Meet?
    21,019
  3. MaxMind GeoLite2 vs. DB-IP Lite vs. ip-api.com: Choosing the Right Free IP Geolocation Solution
    251
  4. Meet Valkey: Why Redis Changed Its License, Why Valkey is Better, and How to Use It as a Drop-in Replacement
    94
  5. How Rogue Web Scrapers Are Stealing My Content and Destroying My Server
    157
  6. Array of arguments passed to script in PHP
    90
  7. Invalid Auction Storms in Ad Tech
    98
  8. Building MRC-Compliant Instrumentation in Ad Tech: Implementation Steps and Key Challenges
    202
  9. The Two Clocks of Ad Server Architecture
    70
  10. Frequency Cap Architecture Overview
    515
  11. Collecting Proof-of-Play from 100,000 Screens
    146
  12. Vector Search in Relational Databases (RDBs): Trends & Usage Environments
    288
  13. What is RedisVL?
    109
  14. Designing a Skill Registry Architecture: Minimize Token Usage and Maximize AI Performance
    232
  15. TPU & GPU Cluster Management Tools
    245
  16. The Concept of Scaffolding in AI Agents
    234
  17. Beyond Static Pipelines: Architecting LLM Multi-Agent Systems for Autonomous Workflow Orchestration
    583
  18. AI-DLC vs. AI-SDLC: Model-Centric vs. System-Centric AI Development
    259
  19. Fine-Tuning Open-Weight LLMs: Training, Licensing, and Deploying Custom Models with Ollama
    339
  20. Inside the Next-Generation Streaming Architecture: Ultra-Low Latency, SGAI, and AI Codecs
    202
  21. Machine Learning: Training vs. Ranking
    222
  22. The Continuous Learning Machine: Designing a Loop That Actually Turns
    222
  23. The Next-Gen Low-Latency Standards: LL-HLS & MoQ
    195
  24. Designing a Data Curation System Around a Vector Database
    221
  25. Extracting Context from Live Video: The Architecture Got Simpler When We Stopped Building Features
    256
  26. The New Ad Stack Behind Live Sports Streaming: Inside SGAI, EABN, and the Standards Race to Fix Live Monetization
    656
  27. Designing MLOps Architectures to Handle Seasonal Data Drift in EV Fleet Models
    196
  28. From 15 to 40+ FPS: Accelerating PyTorch Object Detection on Automotive ECUs
    219
  29. Understanding Data Lineage
    263
  30. System Requirements and Architecture: Intelligent Priority-Based Scheduler
    167