Email senden per csmtp
-
Hey, ich hab mir auf
http://www.codeproject.com/KB/IP/CSmtp.aspx
den source code runtergeladen, allerdings spuckt die konsole folgenden fehler aus:
Invalid winsock2 socket.
Unable to send the mail.
ich hab den code unverändert (bis auf meine email-daten) gelassen..
vielen dank schon mal im voraus
MfG DerCoder
-
Da fragste am Besten beim Support von dem Projekt nach.
-
hm wär cool, wenn mi jmd direkt ne antwort geben könnte, aber danke für den tipp ich werd sie gleich mal anschreiben
-
Versushc mal mit include <windows>
[cpp]
#include <windows>
include "CSmtp.h"
#include <conio>int main()
{
CSmtp mail;if(mail.GetLastError() != CSMTP_NO_ERROR)
{
printf("Unable to initialise winsock2.\n");
return -1;
}mail.SetSMTPServer("smtp.wp.pl",25);
mail.SetLogin("***");
mail.SetPassword("***");
mail.SetSenderName("JP");
mail.SetSenderMail("mail@domain.com");
mail.SetReplyTo("mail@domain.com");
mail.SetSubject("The message");
mail.AddRecipient("friend@domain.com");
mail.SetXPriority(XPRIORITY_NORMAL);
mail.SetXMailer("The Bat! (v3.02) Professional");
mail.SetMessageBody("This is my message.");
mail.AddAttachment("c:\\test.exe");
mail.AddAttachment("c:\\test2.jpg");if( mail.Send() )
printf("The mail was send successfully.\n");
else
{
printf("%s\n",GetErrorText(mail.GetLastError()));
printf("Unable to send the mail.\n");
}return 0;
}
[/cpp}
-
Versushc mal mit include <windows>
[cpp]
#include <windows>
include "CSmtp.h"
#include <conio>int main()
{
CSmtp mail;if(mail.GetLastError() != CSMTP_NO_ERROR)
{
printf("Unable to initialise winsock2.\n");
return -1;
}mail.SetSMTPServer("smtp.wp.pl",25);
mail.SetLogin("***");
mail.SetPassword("***");
mail.SetSenderName("JP");
mail.SetSenderMail("mail@domain.com");
mail.SetReplyTo("mail@domain.com");
mail.SetSubject("The message");
mail.AddRecipient("friend@domain.com");
mail.SetXPriority(XPRIORITY_NORMAL);
mail.SetXMailer("The Bat! (v3.02) Professional");
mail.SetMessageBody("This is my message.");
mail.AddAttachment("c:\\test.exe");
mail.AddAttachment("c:\\test2.jpg");if( mail.Send() )
printf("The mail was send successfully.\n");
else
{
printf("%s\n",GetErrorText(mail.GetLastError()));
printf("Unable to send the mail.\n");
}return 0;
}
[/cpp}
-
#include <windows> #include <conio>
hier sollten beide includes falsch sein...
->#include <windows.h> #include <conio.h>
-
jo danke für die hilfe... ist mir spontan nicht aufgefallen *kopf@tischplatte*