Comments (6)
As described, the port 465 is for TLS and 587 for STARTTLS. Thus, use either
smtps conn("smtp.gmail.com", 465);
conn.authenticate("MY_EMAIL", "MY_PASSWORD", smtps::auth_method_t::LOGIN);
or
smtps conn("smtp.gmail.com", 587);
conn.authenticate("MY_EMAIL", "MY_PASSWORD", smtps::auth_method_t::START_TLS);
Let me know if this helps.
Cheers
from mailio.
Thanks for the response, I can now connect to the smtp server, but when I try to send a message, using conn.submit(msg);
, I get the error:
terminate called after throwing an instance of 'mailio::smtp_error'
what(): Mail sender rejection.
Do I have to set something up to allow my email address to send via smtp?
from mailio.
- Is the authentication email same as the sender email?
- Do you have enabled 2FA for that email account?
from mailio.
- Yes sender and auth email are the same
- No 2FA on the account
from mailio.
Can you please add printing of the received line in the problematic case? So, something like
if (std::get<1>(tokens) && !positive_completion(std::get<0>(tokens)))
{
std::cout << std::get<2>(tokens) << std::endl;
throw smtp_error("Mail sender rejection.");
}
in this part (file and lines smtp.cpp:88-89
), then recompile mailio, start the example again and paste here the result (remove the sensitive info if any). (Obviously I have to add better error reporting in this case.)
from mailio.
I wasn't able to add this line and recompile as I built using vcpkg and it was over complicated trying to rebuild.
But I did setup nodemailer in node.js and was able to figure out how to setup my gmail account to allow it to send via smtp.
Essentially, gmail disabled low security sign in and now you have to enable 2FA and create an app password:
https://stackoverflow.com/a/45479968/15003926
After doing this I am no longer getting the Mail sender rejection error.
from mailio.
Related Issues (20)
- [Question] Image in the body of the message HOT 10
- Please, could anyone provide me an example of how to get the mail content as a unencoded string? HOT 2
- Linking errors HOT 11
- Is it ok to use `-std=c++17` instead of `-std=gnu++1z` HOT 1
- smtps::connection::submit response HOT 2
- add_bcc_recipient HOT 8
- Switching to SSL failed HOT 6
- Parsing failure. HOT 8
- Allow formatting of BCC addresses HOT 2
- when parsing the header of this mime crashed! HOT 14
- mailio stop working with vcpkg? HOT 1
- How to handle the inline image in the mime data? HOT 1
- Tests fail to link: ld: error: undefined symbol: main HOT 3
- Tests fail: error: in "format_attachment_utf8": check ... has failed HOT 2
- problem with static library version HOT 3
- error when linking statically HOT 1
- It looks like a problem with the SSL verification. HOT 2
- Problem when linking the "simple smtp message" example with mingw. HOT 3
- Line policy overflow in a header (mime.cpp) HOT 5
- Devivery report is not received, is it normal ? Event I added header for it !!! HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mailio.