Ways of obtaining people’s emails for the purpose of marketing products to them via e-mail, and the ruling thereon
Question

I work in the field of e-marketing. Part of my job is to offer the company’s services to new customers; in other words, advertising and marketing our products and services through email. There are programs which collect e-mails registered on any website I identify. Is there anything wrong with using such programs? Is there a difference between websites and chat rooms, and what is the evidence for that? The software shows me the websites of different companies, and the companies show the emails to everyone, so can I use that program to collect emails in order to make my job easier? Please note that some of them are licensed programs, and I can buy them if necessary. May Allah reward you with good, and I apologise for the long question.
Praise be to Allah.Firstly:
Working in marketing, whether that is commercial (business-to-business) or regular marketing, or e-marketing, is permissible in principle, but this marketing is haraam if it is done for a company or website that deals with haraam products, such as websites that sell musical recordings, or books that promote innovation (bid‘ah) or immorality, or sell musical instruments, haraam meats, indecent magazines or other things that are prohibited according to Islam.
We have mentioned a number of them, with the shar‘i ruling on marketing them, in the answers to questions no. 107677 and 93376 .
Secondly:
With regard to obtaining people’s emails for the purpose of marketing products by sending them emails, that is subject to further discussion:
1.. If the website – or chat room – which gives the emails of those who join it tells people from the outset and before they agree to sign up that it reserves the right to sell emails to marketing companies and websites, then there is nothing wrong with them doing that, and there is nothing wrong with you working with those websites and chat rooms, and obtaining the lists of emails that they own.
2.. But if the website – or chat room – does not tell people who sign up that they reserve the right to sell their email lists, then it is not permissible for it to keep them and sell them, because they have been entrusted with this information, and it is not permissible for you to work with those websites and chat rooms.
3.. It is not permissible to use hacker programs to access the email lists of a website or chat room, because this is a transgression against the privacy of others, and some of them even go beyond that and hack the email list.
4.. If someone shows his own email on a website or chat room, it is permissible to contact him and market permissible products to him, and it is permissible to use specific software to collect these emails for the purpose of contacting people.
5.. If you contact the owners of these email addresses, then you should state in your message that it is possible to unsubscribe from that list, and you should not send any more messages in that case, because if a person shows his email, that does not mean that he wants to receive marketing messages. Therefore if he indicates that he is not interested, you must respect his wishes and not contact him again.
And Allah knows best.