Posted on

Exchange Online / Microsoft 365 SMTP settings

Generic settings

  • SMTP server: smtp.office365.com
  • Port: 587
  • Requires SSL: Yes
  • Requires TLS: Yes (if available)
  • TLS version : 1.2
  • Authentication: Yes
  • Username: email address
  • Password: Your passwor

User configuration

SMTP sending is not enabled by default.

  • Log in as administrator to the account
  • Tab – Mail
  • Click on “Manage email applications”
  • Select Authenticated SMTP
Posted on

Set up an Office 365 account on GMail

This article was born from the difficulties encountered in setting up a Microsoft Office 365 mail account on the Gmail mail client on a smartphone. But

Reading Office 365 in Gmail is not recommended.

In the Gmail add account screen, the most obvious attempt is to add the account using “Exchange and Office 365”.

You will see the mailbox added correctly and working but we have encountered problems: in some accounts on Gmail you do not see all the mail folders in the mailbox.

Solution

The solution is to perform an installation in imap.

Install the account using “Other”:

Once you have entered your email account, the “Manual Configuration” button appears.

Push it. The procedure will ask you in sequence:

password
address of the mail arrival server: outlook.office365.com
address of the mail receiving server: smtp.office365.com

The procedure does not require the specification of ports. For the sake of completeness, we recall all the parameters of the Microsoft Office 365 imap and smtp.

IMAP settings – Server name: outlook.office365.com – Port: 993 – Encryption method: SSL

SMTP settings – Server name: smtp.office365.com – Port: 587 – Encryption method: TLS or STARTTLS

Important

By doing this you deactivate the synchronization of address book, calendar and email. To solve it, simply go to the Outlook app, in the account and reactivate the synchronization.

But remember that the best thing for Office365 is to use the Outlook app on smartphones. Reading Office 365 in Gmail is not recommended.

 

Posted on

ASP.NET MVC EMAIL FROM SITE AND FORGOT PASSWORD

Our site needs to send emails to its users, for example when the user forgets the password. To do this comes to the rescue System.Net.Mail.SmtpClient class.

This class automatically uses the SMTP server settings stored in the Web.config file. You just have to add to that file the following tags inside the configuration tag:

<system.net>
 <mailSettings>
 <smtp deliveryMethod="Network" from="mail_from">
 <network host="my_smtp_server" port="my_smtp_server_port" userName="user_name_smtp" password="password" clientDomain="my_domain" />
 </smtp>
 </mailSettings>
 </system.net>

FORGOT DIMENTICATA

In the view Account/Login , you can see, bottom, on the left, the link to Account/ForgotPassword that is the page where the user can reset his password.

In the  controller Account, in the action post  “ForgotPassword” you make operational, removing them as a comment, the lines of code dedicated to password recovery.

In the file IdentityConfig.cs, in the function

public Task SendAsync(IdentityMessage message)

and replaced to the line

return Task.FromResult(0);

with the following lines of code

var sentFrom = "myemail@mydomain.com"
 //
 System.Net.Mail.SmtpClient client = new System.Net.Mail.SmtpClient();
 //
 client.EnableSsl = false;

// Create the message:
 var mail =
 new System.Net.Mail.MailMessage(sentFrom, message.Destination);

mail.Subject = message.Subject;
 mail.Body = message.Body;
 mail.IsBodyHtml = true;

// Send:
 return client.SendMailAsync(mail);

You have activated the password recovery