Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 5 Next »

Include Files

Wherever you want to use µC/SMTPc, you should include the following header:

Include file
Description
Source/smtp-c.hContains SMTPc API definitions

Module initialization

µ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 need to create an instance of SMTPc_MSG. 

ElementType

Description

*FromSMTPc_MBOXPointer to the FROM mailbox instance.
*ToArray[SMTPc_CFG_MSG_MAX_TO]SMTPc_MBOXArray of pointer to the TO mailbox instances
*ReplyToSMTPc_MBOXPointer to the ReplyTo mailbox instance
*SenderSMTPc_MBOXPointer to the Sender mailbox instance
*CCArray [SMTPc_CFG_MSG_MAX_CC]SMTPc_MBOXArray of pointer to the TO mailbox instances
*BCCArray [SMTPc_CFG_MSG_MAX_BCC]SMTPc_MBOXArray of pointer to the TO mailbox instances
MsgID [SMTPc_MSG_MSGID_LEN]CPU_CHARUnique msg id
MIMEMsgHdrStructSMTPc_MIME_ENTITY_HDRMail object MIME content headers
*SubjectCPU_CHAREmail subject string
*AttachArray[SMTPc_CFG_MSG_MAX_ATTACH]SMTPc_ATTACHArray of pointer to attachment instances.
*ContentBodyMsgCPU_CHARBody 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 adresse and the name if 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 Files

Wherever you want to use initialize the command in µC/Shell, you should include the following header:

Include file
Description
Cmd/smtp-c_cmd.hContains SMTPc Command definitions

API

Function name
Description
SMTPcCmd_Init()Function to load SMTP client command into shell.

Command reference

Command
Description
Argument
Usage example
smtp_sendSend 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

 

 

  • No labels