Send email using NMSMTP in C ++ Builder (can pass the verification of the mailbox)

xiaoxiao2021-03-06  53

Plus in the head file

#include "idcoder3to4.hpp"

Use the base64encode () function to the username and password encoding

NMSMTP1-> host = "smtp.163.com"; // SMTP hostname nmsmtp1-> userid = "DGYANYONG"; // User name nmsmtp1-> postMessagea-> fromaddress = "DGYANYONG@163.com"; // Letter address nmsmtp1-> postmessagea-> toaddress-> clear (); // recipient address empty NMSMTP1-> postmessagea-> toaddress-> text = "DGYANYONG@sina.com"; // Recipient Address NMSMTP1-> PostMessagea- > TOCARBONCOPY-> text = "DGYANYONG@chinaren.com"; // Cc address nmsmtp1-> postmessagea-> TEXDCARBONCOPY-> text = "DGYANYONG@163.com"; // Dark address NMSMTP1-> PostMESSAGEA-> SUBJECT = "Test Message"; // message title nmsmtp1-> postmessagea-> body-> add ("this is a test message!"); // message content nmsmtp1-> postmessagea-> attachments-> text = "C: / /Qq.doc "; // mail attachment nmsmtp1-> postmessagea-> localprogram =" sendmail "; nmsmtp1-> connect (); if (checkbox1-> checked == true) {Ansistring username = base64encode (" DGYANYONG "); // Code Username Code Ansistring Password = Base64Encode ("DGYANYONG"); // Code Code NMSMTP1-> Transaction ("Auth login"); // Start Verification NMSMTP1-> Transaction (username); NMSMTP1-> Transaction (Password ); Nmsmtp1-> sendmail (); memo1-> lines-> add (" Send mail success "); NMSMTP1-> disconnect ();

The username and password of the above mailbox, the username and password of the 163 mailbox are fictitious, just do an example, the user can set according to their own needs.

转载请注明原文地址:https://www.9cbs.com/read-117432.html

New Post(0)