...
µC/SMTPc does not require to be initialized. Although, if you want to use the DNS features, µC/DNSc shall be properly initialized.
Create an email
To create an email, you will first need to create an instance of SMTPc_MSG.
Structure field | Type | Description |
---|---|---|
*From | SMTPc_MBOX | Pointer to the FROM mailbox instance. |
*ToArray[SMTPc_CFG_MSG_MAX_TO] | SMTPc_MBOX | Array of pointer to the TO mailbox instances |
*ReplyTo | SMTPc_MBOX | Pointer to the ReplyTo mailbox instance |
*Sender | SMTPc_MBOX | Pointer to the Sender mailbox instance |
*CCArray [SMTPc_CFG_MSG_MAX_CC] | SMTPc_MBOX | Array of pointer to the TO mailbox instances |
*BCCArray [SMTPc_CFG_MSG_MAX_BCC] | SMTPc_MBOX | Array of pointer to the TO mailbox instances |
MsgID [SMTPc_MSG_MSGID_LEN] | CPU_CHAR | Unique msg id |
MIMEMsgHdrStruct | SMTPc_MIME_ENTITY_HDR | Mail object MIME content headers |
*Subject | CPU_CHAR | Email subject string |
*AttachArray[SMTPc_CFG_MSG_MAX_ATTACH] | SMTPc_ATTACH | Array of pointer to attachment instances. |
*ContentBodyMsg | CPU_CHAR | Body message of the email. |
ContentBodyMsgLen | CPU_INT32U | Body message length |
This must be first initialized with the function SMTPc_SetMsg(). You will need also to create several instance of SMTPc_MBOX to populate your SMTPc_MSG. SMTPc_MBOX is a mailbox that define the address and the name of a sender (FROM) or a recipient( TO,CC and BCC). SMTPc_SetMbox() is a tool to populate the field of the mailbox.
Function name | Description |
---|---|
SMTPc_SetMsg() | Sets the various fields of a SMTPc_MSG structure so that it is valid and usable |
SMTPc_SetMbox() | Populates a SMTPc_MBOX structure with associated name and address |
Send an email
Function name | Description |
---|---|
SMTPc_SendMail() | Process all the steps to send an email. |
Shell reference
Prerequisite
µC/TCP-IP command module.
...
Include file | Description |
---|---|
Cmd/dnssmtp-c_cmd.h | Contains DNSc SMTPc Command definitions |
API
Function name | Description |
---|---|
DNScCmdSMTPcCmd_Init() | Function to load DNS SMTP client command into shell. |
...
Command | Description | Argument | Usage example | |
---|---|---|---|---|
smtp_ | get_hostsend | Resolve a host name. Will printout all address retrieved for an host. | Host name. | dns_get_host micrium.com |
dns_server_set | Configure the default server. | server ip address. | dns_server_set 8.8.8.8 | |
dns_cache_clr | Clear all host of the DNS cache | none. | dns_cache_clr | |
dnsSend a quick email to test the SMTP setting | -4 <ipv4_address> (use IPv4 server address) -6 <ipv6_address> (use IPv6 server address) -d <domain_name> (use Domain name to get server address) -t <to_address> (set the TO recipient address) | smtp -d smtp.server.com -t test@mail.com | ||
smtp_help | Print help | none | dnssmtp_help |