I have to add new users in a web application. Users need valid email addresses and users are activated by clicking activation link sent to their emails. As I have to add dozens of users so I cannot add so many email addresses. I know websites like yopmail that it generates email address but it is not safe and anyone can access those email links. I need a safe email address so that no one else can access them.
Here is one approach. If you have a Gmail account with an address of, say, email@example.com, I can send emails to you at abdullah+ARBITRARY-STRING@gmail.com.
Each of your users can have a different Gmail address, e.g. firstname.lastname@example.org, email@example.com, and firstname.lastname@example.org, but they will all correspond to the same Gmail account.
Deploy test SMTP server in your local network where the application does have access to that one and external network does not. Configure your DNS (MX record) or your application (test instances usually allow to override the normal mailing configuration) so that the mails are sent through that SMTP server.
I would also strongly recommend everyone to avoid using real messaging infrastructure when test emailing. This might lead to confidential data disclosure so that the company's financial and reputation loss might exceed the cost of googling of how to set up a mail server stub. This also might make gmail or other chosen mail service ban your IP or an IP range since they might consider your traffic suspicious.
You could use local systems like mailcatcher or mailhog. MailHog has a web interface and SMTP port, you can use it as your SMTP target and you'll "receive" all mail in there.
If your application isn't using SMTP but an API and a mail service like sendgrid or mailchimp, this isn't the best thing to since it won't test the API access. Best thing in those cases is to add test credentials and use a non-sending endpoint for tests.
Then, using randomly generated addresses you can do any end-to-end testing that you like without exposing anything. This should be separate from testing the validity of email addresses since this will most likely accept any address.
If it is for testing only, you could use a programming technique called "mocking" or "monkey patching": instead of sending out real emails, your unit or functional tests "replace" function calls or objects of third-party-APIs with a mockup so that in your case, you wouldn't actually send out an email but rather mock the behaviour of sending an email.
This gives you the advantage that no data is actually sent but you can still test all the aspects you need like creating your emails, creating activation links, testing, what happens if a user clicks on a valid link or an invalid link or an expired link, or... the possibilities are endless. You can do these tests over and over again if your testing is using a dedicated test database which gets initialised every time you start a test. This way you don't fill your dev database with junk you'll never need apart from testing.
There is a nice book about testing while developing a web application called "Test-Driven Development With Python" (nicknamed: "Obey the Testing Goat!") which explains the mocking technique nicely in Chapter 19. Altough the web app in question there is based on Python / Django, if you use a different environment the basic principles should still apply. You'll only have to adapt them to your needs.