

def call_sendMail_endpoint(access_token, alias, emailAddress):
    send_mail_url = graph_api_endpoint.format('/me/microsoft.graph.sendMail')
    headers = {
        'User-Agent': 'python_tutorial/1.0',
        'Authorization': 'Bearer {0}'.format(access_token),
        'Accept': 'application/json',
        'Content-Type': 'application/json',
    }
    request_id = str(uuid.uuid4())
    instrumentation = {
        'client-request-id': request_id,
        'return-client-request-id': 'true',
    }
    headers.update(instrumentation)
    email = {
        'Message': {
            'Subject': 'Welcome to Office 365 development with Python and the Office 365 Connect sample',
            'Body': {
                'ContentType': 'HTML',
                'Content': get_email_text(alias),
            },
            'ToRecipients': [{
                'EmailAddress': {
                    'Address': emailAddress,
                },
            }],
        },
        'SaveToSentItems': 'true',
    }
    response = requests.post(url=send_mail_url, headers=headers, data=json.dumps(email), params=None)
    if (response.status_code == requests.codes.accepted):
        return response.status_code
    else:
        return '{0}: {1}'.format(response.status_code, response.text)

dataset/ETHPy150Open OfficeDev/O365-Python-Microsoft-Graph-Connect/connect/graph_service.py call_sendMail_endpoint/original