I am trying to connect with my official mail server using exchangelib library in python and getting the error
"HTTPConnectionPool (host='mail.domainnam.in', port=443): Read timed out. (Read timeout=120)"
def send_mail(content):
# Load environment variables from the .env file
load_dotenv()
# Access environment variables
outlook_user = os.getenv('OUTLOOK_USER')
outlook_password = os.getenv('OUTLOOK_PASS')
outlook_server = os.getenv('OUTLOOK_SERVER')
outlook_email = os.getenv('OUTLOOK_EMAIL')
credentials = Credentials(
username=outlook_user,
password=outlook_password
)
config = Configuration(
server=outlook_server,
credentials=credentials
)
account = Account(
primary_smtp_address=outlook_email,
config=config,
autodiscover=False,
access_type=DELEGATE
)
msg = Message(
account=account,
subject="Test Mail",
body=content,
to_recipients=["email_address_1"],
cc_recipients=["email_address_2"]
)
msg.send_and_save()
I have tried this thread but none of the solution worked "https://github.com/ecederstrand/exchangelib/issues/271"
Please help.
adjust the timeout settings in your exchangelib code.