Author Topic: SMTP module for sending Emails  (Read 14207 times)

modtro2

  • Administrator
  • Hero Member
  • *****
  • Posts: 564
    • View Profile
SMTP module for sending Emails
« on: July 12, 2006, 04:59:56 PM »
This SMTP code was donated by JM DELPRAT from TOULOUSE in FRANCE in 2004. It can be added to the Modtronix TCP/IP stack, and used for sending Emails. I have not tested it yet! Want to integrate it into the Modtronix TCP/IP stack at some time.

This module implements an SMTP client state machine. It will send a mail via a  nearby SMTP server whose IP adress must be programmed in the mysmtp.h file it makes ARP resolving of the SMTP server macadress the client mode must be enabled in the stack it has been tested only with a LOCAL SMTP server running on a PC in  the same subnet.

niroblock

  • Hero Member
  • *****
  • Posts: 140
    • View Profile
SMTP2 module for sending Emails y Auth Login
« Reply #1 on: October 04, 2007, 08:24:00 AM »
This new version of smtp module

 includes:

  Encode64,             
  Auth Login sequence,
  Select send mode ,
  WAN and LAN server SMTP connect.

 
▄▀▄▀█_SMTP.2_█▀▄▀▄
« Last Edit: October 04, 2007, 08:29:03 AM by niroblock »
do not make any questions, if you already have the answer!

certeza

  • Sr. Member
  • ****
  • Posts: 31
    • View Profile
Re: SMTP module for sending Emails
« Reply #2 on: December 01, 2007, 01:46:00 PM »
Changed the state machine because the QUIT command was never sent.

See attached code.
« Last Edit: December 02, 2007, 09:15:33 AM by certeza »

niroblock

  • Hero Member
  • *****
  • Posts: 140
    • View Profile
Re: SMTP module for sending Emails
« Reply #3 on: December 02, 2007, 07:53:59 AM »
Hi Certeza,

Thanks for your contributions

Da pleasure to share the source code with user as active as you!

byee.
do not make any questions, if you already have the answer!

modtro2

  • Administrator
  • Hero Member
  • *****
  • Posts: 564
    • View Profile
Re: SMTP module for sending Emails
« Reply #4 on: December 02, 2007, 03:34:14 PM »
Hi Guys

Thanks for the contributions. Do you mind if I add your code to our stack? I will keep your names in the change log section in the file header of course.

niroblock

  • Hero Member
  • *****
  • Posts: 140
    • View Profile
Re: SMTP module for sending Emails
« Reply #5 on: December 02, 2007, 06:23:57 PM »
Hi big boss, 8-)

No problem for me!

The module also works with encode64 in helpers.c your stack 3.06

Byee.
do not make any questions, if you already have the answer!

certeza

  • Sr. Member
  • ****
  • Posts: 31
    • View Profile
Re: SMTP module for sending Emails
« Reply #6 on: December 02, 2007, 10:23:34 PM »
It would be nice to add DNS resolving first for the SMTP server
(domain name -> ip number)  before adding it to the stack.

The big mail servers outh there don't have a fixed ip number
but use round robin to share the load.



certeza

  • Sr. Member
  • ****
  • Posts: 31
    • View Profile
Added DNS resolving for SMTP hostname
« Reply #7 on: December 03, 2007, 10:53:29 AM »
Check the attached code.
The SMPT module now has DNS hostname resolving for the SMTP server.


Jean-Marc DELPRAT

  • Sr. Member
  • ****
  • Posts: 36
    • View Profile
Re: SMTP module for sending Emails
« Reply #8 on: December 07, 2007, 04:08:39 AM »
Just to say that i'm very glad to see all the improvements to my original small SMTP state machine.

Especially the recent adding of DNS makes it very convenient to use now ! Thanks !!!

I wish that code sharing occurs even more often with various types of code for the benefit of all of us !

Best regards,
JM DELPRAT

Mick93

  • Jr. Member
  • **
  • Posts: 8
    • View Profile
Re: SMTP module for sending Emails
« Reply #9 on: April 07, 2008, 11:25:32 AM »
Hi ! And thank you for this module !

I tried to add it in my code but I have an error during the building process !

"Error - could not find definition of symbol 'DNSIsResolved' in file 'C:\Modtronix\websrvr65_v306\src\tmp\smtp.o'."

But DNSIsResolved is define in dns.h, and dns.h is include in smtp.c ...

Mick93

  • Jr. Member
  • **
  • Posts: 8
    • View Profile
Re: SMTP module for sending Emails
« Reply #10 on: April 12, 2008, 04:55:19 PM »
Up !
Does anybody can help me ?
« Last Edit: April 16, 2008, 10:00:03 AM by Mick93 »

niroblock

  • Hero Member
  • *****
  • Posts: 140
    • View Profile
Re: SMTP module for sending Emails
« Reply #11 on: April 30, 2008, 06:55:37 PM »
hi Mick93,

   
if copies files "dns.c" and "dns.h" in the project folder ....

"linker" ceased to scream

byee.

do not make any questions, if you already have the answer!

OmarZ

  • Hero Member
  • *****
  • Posts: 243
    • View Profile
Re: SMTP module for sending Emails
« Reply #12 on: May 13, 2008, 03:27:45 PM »
Up !
Does anybody can help me ?
It's not a linker problem at all.
You must check if it's defined STACK_USE_DNS in projdefs.h

Code: [Select]
/** @addtogroup mod_conf_projdefs
 * @code #define STACK_USE_DNS @endcode
 * Uncomment if stack should implement DNS
 */
#define STACK_USE_DNS

Regards

OmarZ

  • Hero Member
  • *****
  • Posts: 243
    • View Profile
Re: Added DNS resolving for SMTP hostname
« Reply #13 on: May 13, 2008, 04:09:45 PM »
Check the attached code.
The SMPT module now has DNS hostname resolving for the SMTP server.



If gateway is configured properly, can this works with external servers?
I test but it looks like DNS can' t bre resolved
It never pass DNSIsResolved(&SMTPnodedist.IPAddr)
Code: [Select]
    case SM_SMTP_DNS:
               if (DNSIsResolved(&SMTPnodedist.IPAddr)) {
                 #ifdef SMTP_SER_DEBUG
                 serPutRomString((ROM char*)"DNSIsResolved:\r\n");
                 //---The IP printed on serial port
                 serPutString(itoa(((int)(SMTPnodedist.IPAddr.v[0])),10));
                 serPutByte('.');
                 serPutString(itoa(((int)(SMTPnodedist.IPAddr.v[1])),10));
                 serPutByte('.');
                 serPutString(itoa(((int)(SMTPnodedist.IPAddr.v[2])),10));
                 serPutByte('.');
                 serPutString(itoa(((int)(SMTPnodedist.IPAddr.v[3])),10));
                 serPutByte('\r');
                 serPutByte('\n');
                 #endif
                 SMTPlastActivity = TickGet();
                 ARPResolve(&SMTPnodedist.IPAddr);         // resolve IP adress
                 smSMTP = SM_SMTP_ARP;                             // -> wait ARP answer
               }

gibata

  • Full Member
  • ***
  • Posts: 16
    • View Profile
Re: SMTP module for sending Emails
« Reply #14 on: September 21, 2009, 02:08:43 AM »
When I try to implement the smtpv4 code I get this error after compiling but I dont know why

src\serint.h:102:Error [1104] division by zero in constant expression
src\serint.h:104:Error [1099] "Calculated SPBRG value is out of range for currnet (40000000L)

I have fimware 3.10 installed

Can somebody help?

THX