--- /dev/null
+#
+# For a description of the syntax of this configuration file,
+# see kconfig-language at https://www.kernel.org/doc/Documentation/kbuild/kconfig-language.txt
+#
+
+config EXAMPLES_SMTPCLIENT
+ bool "SMTP client example"
+ depends on NETUTILS_SMTP
+ default n
+ ---help---
+ Enable the SMTP client example
+
+config USER_ENTRYPOINT
+ string
+ default "smtpc_main" if ENTRY_SMTPCLIENT
--- /dev/null
+config ENTRY_SMTPCLIENT
+ bool "SMTP client example"
+ depends on EXAMPLES_SMTPCLIENT
+
--- /dev/null
+###########################################################################
+#
+# Copyright 2017 Samsung Electronics All Rights Reserved.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
+# either express or implied. See the License for the specific
+# language governing permissions and limitations under the License.
+#
+###########################################################################
+
+ifeq ($(CONFIG_EXAMPLES_SMTPCLIENT),y)
+CONFIGURED_APPS += examples/smtp_client
+endif
--- /dev/null
+###########################################################################
+#
+# Copyright 2017 Samsung Electronics All Rights Reserved.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
+# either express or implied. See the License for the specific
+# language governing permissions and limitations under the License.
+#
+###########################################################################
+
+-include $(TOPDIR)/.config
+-include $(TOPDIR)/Make.defs
+include $(APPDIR)/Make.defs
+
+# built-in application info
+
+APPNAME = smtpc
+THREADEXEC = TASH_EXECMD_ASYNC
+FUNCNAME = smtpc_main
+
+# smtp client example
+
+ASRCS =
+CSRCS =
+MAINSRC = smtp_client.c
+
+AOBJS = $(ASRCS:.S=$(OBJEXT))
+COBJS = $(CSRCS:.c=$(OBJEXT))
+MAINOBJ = $(MAINSRC:.c=$(OBJEXT))
+
+SRCS = $(ASRCS) $(CSRCS) $(MAINSRC)
+OBJS = $(AOBJS) $(COBJS)
+
+ifneq ($(CONFIG_BUILD_KERNEL),y)
+ OBJS += $(MAINOBJ)
+endif
+
+ifeq ($(CONFIG_WINDOWS_NATIVE),y)
+ BIN = ..\..\libapps$(LIBEXT)
+else
+ifeq ($(WINTOOL),y)
+ BIN = ..\\..\\libapps$(LIBEXT)
+else
+ BIN = ../../libapps$(LIBEXT)
+endif
+endif
+
+ifeq ($(WINTOOL),y)
+ INSTALL_DIR = "${shell cygpath -w $(BIN_DIR)}"
+else
+ INSTALL_DIR = $(BIN_DIR)
+endif
+
+CONFIG_EXAMPLES_SMTPCLIENT_PROGNAME ?= smtpc$(EXEEXT)
+PROGNAME = $(CONFIG_EXAMPLES_SMTPCLIENT_PROGNAME)
+
+ROOTDEPPATH = --dep-path .
+
+
+# Common build
+
+VPATH =
+
+all: .built
+.PHONY: clean depend distclean
+
+$(AOBJS): %$(OBJEXT): %.S
+ $(call ASSEMBLE, $<, $@)
+
+$(COBJS) $(MAINOBJ): %$(OBJEXT): %.c
+ $(call COMPILE, $<, $@)
+
+.built: $(OBJS)
+ $(call ARCHIVE, $(BIN), $(OBJS))
+ @touch .built
+
+ifeq ($(CONFIG_BUILD_KERNEL),y)
+$(BIN_DIR)$(DELIM)$(PROGNAME): $(OBJS) $(MAINOBJ)
+ @echo "LD: $(PROGNAME)"
+ $(Q) $(LD) $(LDELFFLAGS) $(LDLIBPATH) -o $(INSTALL_DIR)$(DELIM)$(PROGNAME) $(ARCHCRT0OBJ) $(MAINOBJ) $(LDLIBS)
+ $(Q) $(NM) -u $(INSTALL_DIR)$(DELIM)$(PROGNAME)
+
+install: $(BIN_DIR)$(DELIM)$(PROGNAME)
+
+else
+install:
+
+endif
+
+ifeq ($(CONFIG_BUILTIN_APPS)$(CONFIG_EXAMPLES_SMTPCLIENT),yy)
+$(BUILTIN_REGISTRY)$(DELIM)$(APPNAME)_main.bdat: $(DEPCONFIG) Makefile
+ $(call REGISTER,$(APPNAME),$(FUNCNAME),$(THREADEXEC))
+
+context: $(BUILTIN_REGISTRY)$(DELIM)$(APPNAME)_main.bdat
+
+else
+context:
+
+endif
+
+.depend: Makefile $(SRCS)
+ @$(MKDEP) $(ROOTDEPPATH) "$(CC)" -- $(CFLAGS) -- $(SRCS) >Make.dep
+ @touch $@
+
+depend: .depend
+
+clean:
+ $(call DELFILE, .built)
+ $(call CLEAN)
+
+distclean: clean
+ $(call DELFILE, Make.dep)
+ $(call DELFILE, .depend)
+
+-include Make.dep
+.PHONY: preconfig
+preconfig:
--- /dev/null
+/****************************************************************************
+ *
+ * Copyright 2017 Samsung Electronics All Rights Reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
+ * either express or implied. See the License for the specific
+ * language governing permissions and limitations under the License.
+ *
+ ****************************************************************************/
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+#include <net/if.h>
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+int smtpc_main(int argc, char *argv[])
+{
+ if (argc != 7) {
+ printf("Usage:\n");
+ printf(" %s [xx.xx.xx.xx] [yy.yy.yy.yy] [To:] [From:] [Subject] [Message]\n", argv[0]);
+ printf(" xx.xx.xx.xx is the IP address of the SMTP server\n");
+ printf(" yy.yy.yy.yy is the IP address of the SMTP client(localhost)\n");
+ return 0;
+ }
+
+ int msglen;
+ int result_smtp;
+
+ printf("SMTP Client Start!!\n\n------------------------\n\n");
+ msglen = strlen(argv[6]);
+
+ //test smtp_open
+ void *handle = NULL;
+ handle = (void *)smtp_open();
+ if (handle != NULL) {
+ printf("1. smtp_open : Successed\n");
+ } else {
+ printf("1. smtp_open : failed\n");
+ }
+
+ //test smtp_configure
+ struct in_addr addr;
+ inet_pton(AF_INET, argv[1], &(addr.s_addr));
+ smtp_configure(handle, argv[2], addr.s_addr);
+ printf("2. smtp_configure : Successed\n");
+
+ result_smtp = smtp_send(handle, argv[3], 0, argv[4], argv[5], argv[6], msglen);
+ if (result_smtp == OK) {
+ printf("3. smtp_send : Successed\n");
+ } else {
+ printf("3. smtp_send : failed\n");
+ }
+
+ smtp_close(handle);
+ printf("------------------------\n\nstmp client test finish!!\n");
+ return 0;
+}