Closed UnknownObject000 closed 1 year ago
Here is an example which is similar to yours:
mailio::message msg;
msg.from(mailio::mail_address("mailio", "adresa@mailio.dev"));
msg.add_recipient(mailio::mail_address("mailio", "adresa@mailio.dev"));
msg.add_cc_recipient(mailio::mail_address("mailio", "adresa@mailio.dev"));
msg.add_bcc_recipient(mailio::mail_address("mailio", "adresa@mailio.dev"));
msg.subject("issue120");
msg.content_transfer_encoding(mailio::mime::content_transfer_encoding_t::QUOTED_PRINTABLE);
msg.content_type(mailio::mime::media_type_t::TEXT, "plain", "gb2312");
msg.content("issue120");
smtps conn("smtp.mailio.dev", 465);
conn.authenticate("adresa@mailio.dev", "***", smtps::auth_method_t::LOGIN);
conn.submit(msg);
I do not have any segmentation faults on Ubuntu/Gcc. Can you confirm that this simplified example works in your case? Also take care that you are using the correct port number which requires SSL immediately, not the START TLS port.
Here is an example which is similar to yours:
mailio::message msg; msg.from(mailio::mail_address("mailio", "adresa@mailio.dev")); msg.add_recipient(mailio::mail_address("mailio", "adresa@mailio.dev")); msg.add_cc_recipient(mailio::mail_address("mailio", "adresa@mailio.dev")); msg.add_bcc_recipient(mailio::mail_address("mailio", "adresa@mailio.dev")); msg.subject("issue120"); msg.content_transfer_encoding(mailio::mime::content_transfer_encoding_t::QUOTED_PRINTABLE); msg.content_type(mailio::mime::media_type_t::TEXT, "plain", "gb2312"); msg.content("issue120"); smtps conn("smtp.mailio.dev", 465); conn.authenticate("adresa@mailio.dev", "***", smtps::auth_method_t::LOGIN); conn.submit(msg);
I do not have any segmentation faults on Ubuntu/Gcc. Can you confirm that this simplified example works in your case? Also take care that you are using the correct port number which requires SSL immediately, not the START TLS port.
This example runs fine. I'm using a 163.com mailbox and the same 465 port, it works fine on windows.
Did you try the port 587 with the start tls option?
Did you try the port 587 with the start tls option?
It doesn't work. I have re-tested the example, it still crashs.
Here is an example which is similar to yours:
mailio::message msg; msg.from(mailio::mail_address("mailio", "adresa@mailio.dev")); msg.add_recipient(mailio::mail_address("mailio", "adresa@mailio.dev")); msg.add_cc_recipient(mailio::mail_address("mailio", "adresa@mailio.dev")); msg.add_bcc_recipient(mailio::mail_address("mailio", "adresa@mailio.dev")); msg.subject("issue120"); msg.content_transfer_encoding(mailio::mime::content_transfer_encoding_t::QUOTED_PRINTABLE); msg.content_type(mailio::mime::media_type_t::TEXT, "plain", "gb2312"); msg.content("issue120"); smtps conn("smtp.mailio.dev", 465); conn.authenticate("adresa@mailio.dev", "***", smtps::auth_method_t::LOGIN); conn.submit(msg);
I do not have any segmentation faults on Ubuntu/Gcc. Can you confirm that this simplified example works in your case? Also take care that you are using the correct port number which requires SSL immediately, not the START TLS port.
This example runs fine. I'm using a 163.com mailbox and the same 465 port, it works fine on windows.
This test result is invalidate. I have tested the wrong program by mistake, sorry.
So, my simplified example crashes too?
So, my simplified.example crashes too?
The example reports this error:
terminate called after throwing an instance of 'mailio::dialog_error'
what(): Server connecting failed.
Aborted
I changed it to my server setup, it crashed with the same Segmentation fault
error.
Another whield thing is when I created a new program like this
#include <iostream>
#include <mailio/smtp.hpp>
#include <mailio/message.hpp>
int main()
{
mailio::message msg;
msg.from(mailio::mail_address("mailio", "xxxxxx@163.com"));
msg.add_recipient(mailio::mail_address("mailio", "adresa@mailio.dev"));
msg.add_cc_recipient(mailio::mail_address("mailio", "adresa@mailio.dev"));
msg.add_bcc_recipient(mailio::mail_address("mailio", "adresa@mailio.dev"));
msg.subject("issue120");
msg.content_transfer_encoding(mailio::mime::content_transfer_encoding_t::QUOTED_PRINTABLE);
msg.content_type(mailio::mime::media_type_t::TEXT, "plain", "gb2312");
msg.content("issue120");
mailio::smtps conn("smtp.163.com", 465);
conn.authenticate("xxxxxx@163.com", "xxxxxx", mailio::smtps::auth_method_t::LOGIN);
conn.submit(msg);
return 0;
}
it doesn't crash.
So, when you use the example with your credentials it works, but after your code changes it does not work?
So, when you use the example with your credentials it works, but after your code changes it does not work?
Yes.
But then it's a problem with your changes, right?
I wrote an SMTP function like this:
It works fine on Windows 11 x64/Visual Studio 2022, but when I run it on Ubuntu LTS 20.04/g++ 9.4.0, it causes Segmentation fault. GDB Info:
My compile command:
g++ -o heartbeat_server SMTPSender.cpp -pthread -lcrypto -ljsoncpp -lmailio -std=c++17