• Print

Author Topic: GMX SMTP problems  (Read 87 times)

Gorlock

  • Sr. Member
  • ****
  • Posts: 337
    • Email
GMX SMTP problems
« on: October 17, 2012, 04:49:06 PM »
Hi, I have been messing around with trying to send emails using gmx.com. GMX doesn't require SSL or TLS.

http://email.about.com/od/gmxmailtips/f/GMX_Mail_SMTP_Server_Settings.htm

Using this code I have been able to send an email to the recipients email address, but it doesn't say who it is from, who its to, or what the message is. It is just a blank anonymous message that is received in the spam box. I think that the headers the program is sending are wrong or out of order or something, but I have no idea how to figure out what headers gmx.com needs without just completely guessing. A google search wasn't much help. I have made a sample recipient and sending email adress so that you can test it and see the message without having to go throught the trouble of making 2 new accounts. Anyway, all help or ideas are appreciated, here is the code:

Code: [Select]
uemail$ = "qb64.sender@gmx.com" 'sending email adress (must be with gmx.com)
upass$ = "qb64test" 'user password
remail$ = "qb64.recipient@gmx.com" 'recipients email adress (must be with gmx.com)

rpass$ = "qb64test" 'recipients password (not needed for this program, but you can log in to this account to check the message that the program sent)

crlf$ = CHR$(13) + CHR$(10)

c = _OPENCLIENT("tcp/ip:25:smtp.gmx.com")
IF c = 0 THEN SYSTEM
a$ = "EHLO localhost" + crlf$
PUT #c, , a$
GET #c, , b$

_CLIPBOARD$ = "" + crlf$ + "~" + crlf$ + b$

a$ = "AUTH LOGIN" + crlf$
PUT #c, , a$
GET #c, , b$

_CLIPBOARD$ = _CLIPBOARD$ + crlf$ + "~" + crlf$ + b$

base64e$ = convbase64$(uemail$) + crlf$
PUT #c, , base64e$
GET #c, , b$

_CLIPBOARD$ = _CLIPBOARD$ + crlf$ + "~" + crlf$ + b$

base64p$ = convbase64$(upass$) + crlf$
PUT #c, , base64p$
SLEEP 2
GET #c, , check$

_CLIPBOARD$ = _CLIPBOARD$ + crlf$ + "~" + crlf$ + b$

IF NOT UCASE$(MID$(check$, LEN(check$) - 10, 8)) <> "ACCEPTED" THEN SYSTEM
a$ = "MAIL FROM:<" + uemail$ + ">" + crlf$
PUT #c, , a$
a$ = "RCPT TO:<" + remail$ + ">" + crlf$
PUT #c, , a$
a$ = "DATA" + crlf$
PUT #c, , a$
a$ = ""
a$ = a$ + "From: " + "<" + uemail$ + ">" + crlf$
a$ = a$ + "To: " + "<" + remail$ + ">" + crlf$
a$ = a$ + "Subject: Test" + crlf$ + crlf$
DO


    a$ = "Hi" + crlf$
    PUT #c, , a$
    a$ = ""
    EXIT DO

    rtn$ = ""
    locat = 0
    row1 = CSRLIN
    LOCATE row1, 1
    PRINT SPACE$(80);
    DO
        _LIMIT 32
        LOCATE row1, 1
        PRINT rtn$; " ";
        LOCATE row1 + locat \ 80, (locat MOD 80) + 1, 1
        DO
            _LIMIT 64
            k$ = INKEY$
        LOOP UNTIL LEN(k$)
        SELECT CASE k$
            CASE CHR$(8)
                IF locat > 0 THEN
                    rtn$ = MID$(rtn$, 1, locat - 1) + MID$(rtn$, locat + 1)
                    locat = locat - 1
                END IF
            CASE CHR$(13)
                IF rtn$ = "*END*" THEN rtn$ = CHR$(255)
                a$ = rtn$
                EXIT DO
            CASE CHR$(22)
                rtn$ = MID$(rtn$, 1, locat) + _CLIPBOARD$ + MID$(rtn$, locat + 1)
            CASE CHR$(32) TO CHR$(126)
                rtn$ = MID$(rtn$, 1, locat) + k$ + MID$(rtn$, locat + 1)
                locat = locat + 1
            CASE (CHR$(0) + CHR$(71))
                locat = 0
            CASE (CHR$(0) + CHR$(75))
                IF locat > 0 THEN locat = locat - 1
            CASE (CHR$(0) + CHR$(77))
                IF locat < LEN(rtn$) + 1 THEN locat = locat + 1
            CASE (CHR$(0) + CHR$(79))
                locat = LEN(rtn$)
            CASE (CHR$(0) + CHR$(83))
                IF locat < LEN(rtn$) THEN rtn$ = MID$(rtn$, 1, locat) + MID$(rtn$, locat + 2)
        END SELECT
        IF row1 + LEN(rtn$) \ 80 > 24 THEN
            LOCATE 25, 1
            PRINT
            row1 = row1 - 1
            FOR x = row1 TO 24
                LOCATE x, 1
                PRINT SPACE$(80);
            NEXT x
        END IF
    LOOP
    IF a$ = CHR$(255) THEN EXIT DO
    PRINT
    a$ = a$ + crlf$
    PUT #c, , a$
    a$ = ""
LOOP
a$ = "." + crlf$
PUT #c, , a$
SLEEP 2
GET #c, , b$

_CLIPBOARD$ = _CLIPBOARD$ + crlf$ + "~" + crlf$ + b$

PUT #c, , a$
SLEEP 2
GET #c, , b$

_CLIPBOARD$ = _CLIPBOARD$ + crlf$ + "~" + crlf$ + b$

CLOSE c
SYSTEM

FUNCTION convbase64$ (bit8$)
IF bit8$ = "" THEN EXIT FUNCTION
base64$ = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"
pad = LEN(bit8$) MOD 3
unenc$ = bit8$ + STRING$(pad + 1, "=")
st = 1
enc$ = ""
DO
    bytes$ = ""
    FOR x = st TO st + 2
        bytes$ = bytes$ + bin$(ASC(MID$(unenc$, x, 1)))
    NEXT x
    FOR x = 1 TO 4
        num = todecimal(MID$(bytes$, x * 6 - 5, 6))
        enc$ = enc$ + MID$(base64$, num + 1, 1)
    NEXT x
    st = st + 3
LOOP UNTIL LEN(unenc$) - st - 1 <= 0
enc$ = LEFT$(enc$, LEN(enc$) - pad + 1)
enc$ = enc$ + STRING$(pad - 1, "=")
convbase64$ = enc$
END FUNCTION

FUNCTION bin$ (num%)
IF num% = 0 THEN EXIT SUB
DO
    remain% = ABS(num% MOD 2)
    num% = num% \ 2
    bin$ = LTRIM$(STR$(remain%))
    bintotal$ = bin$ + bintotal$
LOOP UNTIL num% = 0
bin$ = STRING$(8 - LEN(bintotal$), "0") + bintotal$
END SUB

FUNCTION todecimal (binary1$)
FOR x = 1 TO LEN(binary1$)
    dec = dec + VAL(MID$(binary1$, x, 1)) * (2 ^ (LEN(binary1$) - x))
NEXT x
todecimal = dec
END FUNCTION

  • Print