 |
|
 |
Hello,
Am having problem compiling, can you give some help.
Compiling...
base64.cpp
CSmtp.cpp
main.cpp
c:\documents and settings\admin\my documents\csmtp_v2_0_ssl\csmtp_v2_0_ssl\main.cpp(16) : error C2039: 'USE_TLS' : is not a member of 'CSmtp'
c:\documents and settings\admin\my documents\csmtp_v2_0_ssl\csmtp_v2_0_ssl\csmtp.h(164) : see declaration of 'CSmtp'
md5.cpp
Generating Code...
An it pointing to the bold line
#if defined(test_gmail_tls)
mail.SetSMTPServer("smtp.gmail.com",587);
mail.SetSecurityType(CSmtp::USE_TLS);
#elif defined(test_gmail_ssl)
How can i convert this project to c#
Regards
modified 2 days ago.
|
|
|
|
 |
|
 |
I am not using main.cpp for my work (I have my own main), but it appears that...
1.9 and earlier USE_TLS was in class CSmtp
2.0 USE_TLS is now outside the class
Try this
#if defined(test_gmail_tls)
mail.SetSMTPServer("smtp.gmail.com",587);
mail.SetSecurityType(USE_TLS);
#elif defined(test_gmail_ssl)
|
|
|
|
 |
|
 |
Thanks for responding, am trying to compile this into a dll, so i can use it in my c# app, how do i do this?
Wh i compiled, i get a CSmtp.exe in the debug directory. Honestly, am no good in vc++, but i am average programmer in c# and java etc just not c++. if you can provide a link to building and compiling vc++ projects, i'd appreciate it
regards
|
|
|
|
 |
|
 |
Sorry, can't help you there.
No experience with building .dlls.
Haven't even looked at the VisualStudio solution/project for this... I am working in Linux.
However, VisualStudio... if your can sort out dlls in C#, it shouldn't be too different in C++?
|
|
|
|
 |
|
 |
hi,
i'm getting the error that USE_SSL is no member of CSmtp.
whats wrong? i just copied it ...
thank you very much for answering
|
|
|
|
 |
|
 |
Shouldn't be a problem.
USE_SSL is a member of enum SMTP_SECURITY_TYPE in class CSmtp in CSmtp.h
I presume that you are using the latest (2.0) code?
What line is the error being reported at?
|
|
|
|
 |
|
 |
Talking rubbish...
Depends on which version you are using
1.9 and earlier USE_TLS is a member of class CSmtp
2.0 it is an enum in SMTP_SECURITY_TYPE (not within the class)
main.cpp is wrong for 2.0; it still has the class prefix (CSmtp: which will need to be removed.
|
|
|
|
 |
|
 |
I have been successfully compiled and used this library on Debian Linux amd64.
Patch is here
Regards,
Oleg Dolgov
|
|
|
|
 |
|
 |
Hello
I get this error when compiling:
'AF_INET' : undeclared identifier
I only get it on my stationary computer but not on my laptop.
Can anyone please help me solve this problem?
|
|
|
|
 |
|
 |
This error is show when the program is sending data and the internet connection is done or the connection not respond [slow connection].
then is show a error window and the program is closed.
The program doesn't detect this error, because the program is ended.
--Good code, is a wonder.
|
|
|
|
 |
|
 |
How can I send the text message from a file , same the attachments?.
I was trying to do that, but I need learn more, thanks.
Note:Sorry for my bad English.
|
|
|
|
 |
|
 |
Nice project.
I would like it if you could work on an x64 target too? I'd do it myself, but I think it'd be faster for you do to do it.
|
|
|
|
 |
|
 |
if the attachement is less than 4M, it goes well. but when the attachment is 5M+, it will crash. plz help!
|
|
|
|
 |
|
 |
I debug the csmtp code, and I find the problem.
// sending the file:
if(TotalSize/1024 > MSG_SIZE_IN_MB*1024)
throw ECSmtp(ECSmtp::MSG_TOO_BIG);
The MSG_SIZE_IN_MB is only 5, meaning that it can juse send an attachment less than 5M.
|
|
|
|
 |
|
 |
Hello!
I'm using the Makefile I got with the previous version of the project ( SMTP Client[^] )
makefile:
# Automatyczny makefile
CC = g++
CFLAGS = -Wall -O2 -DLINUX
ONLYCOMPILE = $(CC) $(CFLAGS) -c -g
OBJFILES := $(patsubst %.cpp,%.o,$(wildcard *.cpp))
PROGNAME = CSmtp
all: $(PROGNAME)
$(PROGNAME) : $(OBJFILES)
$(CC) -o $(PROGNAME) $(OBJFILES)
%.o: %.cpp
${ONLYCOMPILE} -o $@ $<
clean:
rm *.o
While compiling I got the following problem:
g++ -Wall -O2 -DLINUX -c -g -o CSmtp.o CSmtp.cpp
In file included from CSmtp.cpp:43:0:
CSmtp.h:42:25: fatal error: openssl/ssl.h: No such file or directory
compilation terminated.
make: *** [CSmtp.o] Error 1
fatal error: openssl/ssl.h: No such file or directory
"openssl-0.9.8l\inc32" was already added to "Additional Include Directories" and "openssl-0.9.8l\out32" to "Additional Library Directories". This was done by the author i suppose?
Can someone help me with this problem plz?
Thank a lot!
|
|
|
|
 |
|
 |
Right or wrong, I don't know, but this is what I do...
I am building on Debian using a Makefile very similar to yours.
I do not use openssl-0.9.8l/out32/ at all.
I have discarded the openssl-0.9.8l/inc32/ directory and placed its openssl/ directory in my source directory (hence openssl/ssl.h is now accessible from the source directory).
|
|
|
|
 |
|
 |
Nice implementation on a subject not covered by many authors (SMTP with Encryption).
|
|
|
|
 |
|
 |
Can I suggest that you possibly consider adding the ability to include an attachment type and an attachment ID property to the function AttachmentAdd? I believe that the functionality of this code will increase with that to allow me to include images in the email. Thanks!
|
|
|
|
 |
|
 |
I am no expert in this, so when I wanted to send a .jpg image, I just sent it.
At the receiving end, it I just double-clicked it to open the image, which seemed to be all that I needed.
In fact, I can attach any number of file types and the behave as expected at the receiving end.
|
|
|
|
 |
|
 |
Found a few memory leaks in your sorce code using
mail.SetSecurityType(USE_TLS);
---------- Block 3951 at 0x00EFFC60: 96 bytes ----------
Call Stack:
f:\dd\vctools\crt_bld\self_x86\crt\src\dbgmalloc.c (56): malloc
0x0054D68B (File and line number not available): send
d:\doki\downloads\csmtp_v2_0_ssl (1)\csmtp_v2_0_ssl\csmtp.cpp (1949): CSmtp::StartTls
d:\doki\downloads\csmtp_v2_0_ssl (1)\csmtp_v2_0_ssl\csmtp.cpp (803): CSmtp::ConnectRemoteServer
d:\doki\downloads\csmtp_v2_0_ssl (1)\csmtp_v2_0_ssl\csmtp.cpp (488): CSmtp::Send
d:\doki\downloads\csmtp_v2_0_ssl (1)\csmtp_v2_0_ssl\main.cpp (56): main
f:\dd\vctools\crt_bld\self_x86\crt\src\crt0.c (266): __tmainCRTStartup
f:\dd\vctools\crt_bld\self_x86\crt\src\crt0.c (182): mainCRTStartup
0x7C817077 (File and line number not available): RegisterWaitForInputIdle
Data:
00 FD EF 00 90 91 54 00 80 91 54 00 08 00 00 00 ......T. ..T.....
10 00 00 00 00 00 00 00 08 00 00 00 00 02 00 00 ........ ........
00 01 00 00 01 00 00 00 00 00 00 00 00 00 00 00 ........ ........
00 00 00 00 00 00 00 00 08 00 00 00 07 00 00 00 ........ ........
01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ........ ........
07 00 00 00 00 00 00 00 07 00 00 00 00 00 00 00 ........ ........
---------- Block 169 at 0x00E83440: 20 bytes ----------
Call Stack:
f:\dd\vctools\crt_bld\self_x86\crt\src\dbgmalloc.c (56): malloc
0x0054D68B (File and line number not available): send
d:\doki\downloads\csmtp_v2_0_ssl (1)\csmtp_v2_0_ssl\csmtp.cpp (789): CSmtp::ConnectRemoteServer
d:\doki\downloads\csmtp_v2_0_ssl (1)\csmtp_v2_0_ssl\csmtp.cpp (488): CSmtp::Send
d:\doki\downloads\csmtp_v2_0_ssl (1)\csmtp_v2_0_ssl\main.cpp (56): main
f:\dd\vctools\crt_bld\self_x86\crt\src\crt0.c (266): __tmainCRTStartup
f:\dd\vctools\crt_bld\self_x86\crt\src\crt0.c (182): mainCRTStartup
0x7C817077 (File and line number not available): RegisterWaitForInputIdle
Data:
00 00 00 00 28 35 E8 00 01 00 00 00 04 00 00 00 ....(5.. ........
80 0B 53 00
Memory leaks were found by
Visual Leak Detector -
Enhanced Memory Leak Detection for Visual C++[^]
pluri
|
|
|
|
 |
|
 |
I don't detect any memory leaks, did you call mail.~Csmtp() at the end? The author did not write that in the code sample, probably because mail was created as a local variable, and thus deleted automatically at the end anyways. However, I used pointers to the class instead, and called both the destructor as well as delete[] at the end. See if that helps.
|
|
|
|
 |
|
 |
Can you enable old versions?
thanks.
|
|
|
|
 |
|
 |
Are you asking if we can make it so you can get to past revisions of this article? If so, you can get to them by clicking the "Revisions" tab at the top of the page.
|
|
|
|
 |
|
|
 |
|
 |
Hi all,
Thanks for your great code and comments, it is very helpful!
Now I need to modify it into MS VC++ 6 version because that's what my application was developed with. There are some issues. I had a try but failed to fix some of them:
ERROR 1:
csmtp.cpp: error C2665: 'delete' : none of the 2 overloads can convert parameter 1 from type 'const unsigned char *'
const unsigned char *ustrLogin = CharToUnsignedChar(SendBuf);
std::string encoded_login = base64_encode(ustrLogin, strlen(SendBuf));
delete[] ustrLogin;
ERROR 2:
csmtp.cpp: error C2079: 'addr' uses undefined struct 'sockaddr_storage'
struct sockaddr_storage addr;
Could you please guide me how to fix the error? Thanks for your help in advance!
|
|
|
|
 |