Guys I am trying To send a mail using C++ code i found from the net , when i compiled it it says
In function `_Z13ChilkatSamplev':
[Linker error] C:/Users/dhayalan/Documents/mail.cpp:10: undefined reference to `CkMailMan::CkMailMan()'
[Linker error] C:/Users/dhayalan/Documents/mail.cpp:14: undefined reference to `CkMailMan::UnlockComponent(char const*)'
[Linker error] C:/Users/dhayalan/Documents/mail.cpp:21: undefined reference to `CkMailMan::put_SmtpHost(char const*)'
[Linker error] C:/Users/dhayalan/Documents/mail.cpp:24: undefined reference to `CkMailMan::put_SmtpUsername(char const*)'
[Linker error] C:/Users/dhayalan/Documents/mail.cpp:25: undefined reference to `CkMailMan::put_SmtpPassword(char const*)'
[Linker error] C:/Users/dhayalan/Documents/mail.cpp:28: undefined reference to `CkEmail::CkEmail()'
[Linker error] C:/Users/dhayalan/Documents/mail.cpp:30: undefined reference to `CkEmail::put_Subject(char const*)'
[Linker error] C:/Users/dhayalan/Documents/mail.cpp:31: undefined reference to `CkEmail::put_Body(char const*)'
[Linker error] C:/Users/dhayalan/Documents/mail.cpp:32: undefined reference to `CkEmail::put_From(char const*)'
[Linker error] C:/Users/dhayalan/Documents/mail.cpp:33: undefined reference to `CkEmail::AddTo(char const*, char const*)'
[Linker error] C:/Users/dhayalan/Documents/mail.cpp:52: undefined reference to `CkMailMan::CloseSmtpConnection()'
[Linker error] C:/Users/dhayalan/Documents/mail.cpp:55: undefined reference to `CkEmail::~CkEmail()'
[Linker error] C:/Users/dhayalan/Documents/mail.cpp:55: undefined reference to `CkMailMan::~CkMailMan()'
[Linker error] C:/Users/dhayalan/Documents/mail.cpp:55: undefined reference to `CkEmail::~CkEmail()'
[Linker error] C:/Users/dhayalan/Documents/mail.cpp:55: undefined reference to `CkMailMan::~CkMailMan()'
In function `_ZN9CkMailMan9SendEmailERK7CkEmail':
[Linker error] c:/program files/dev-cpp/mingw32/bin/../lib/gcc/mingw32/4.7.0/../../../../include/CkMailMan.h:469: undefined reference to `CkMailMan::SendEmail(CkEmail const*)'
C:\Users\dhayalan\Documents\collect2.exe [Error] ld returned 1 exit status
The program is :
i found this Program From http://www.example-code.com/vcpp/smtp_simpleSend.asp
And the necessary headers from http://www.chilkatsoft.com/downloads_vcpp.asp
The linker error is with in the function , as i dint call it too !
pls help and thanks in advance .
#include <CkMailMan.h>
#include <CkEmail.h>
int main(){
}
void ChilkatSample(void)
{
// The mailman object is used for sending and receiving email.
CkMailMan mailman;
// Any string argument automatically begins the 30-day trial.
bool success;
success = mailman.UnlockComponent("30-day trial");
if (success != true) {
//printf("%s\n",mailman.lastErrorText());
return;
}
// Set the SMTP server.
mailman.put_SmtpHost("smtp.chilkatsoft.com");
// Set the SMTP login/password (if required)
mailman.put_SmtpUsername("myUsername");
mailman.put_SmtpPassword("myPassword");
// Create a new email object
CkEmail email;
email.put_Subject("This is a test");
email.put_Body("This is a test");
email.put_From("Chilkat Support <support@chilkatsoft.com>");
email.AddTo("Chilkat Admin","admin@chilkatsoft.com");
// To add more recipients, call AddTo, AddCC, or AddBcc once per recipient.
// Call SendEmail to connect to the SMTP server and send.
// The connection (i.e. session) to the SMTP server remains
// open so that subsequent SendEmail calls may use the
// same connection.
success = mailman.SendEmail(email);
if (success != true) {
//printf("%s\n",mailman.lastErrorText());
return;
}
// Some SMTP servers do not actually send the email until
// the connection is closed. In these cases, it is necessary to
// call CloseSmtpConnection for the mail to be sent.
// Most SMTP servers send the email immediately, and it is
// not required to close the connection. We'll close it here
// for the example:
success = mailman.CloseSmtpConnection();
if (success != true) {
//printf("Connection to SMTP server not closed cleanly.\n");
}
// printf("Mail Sent!\n");
}