c# - 如何解决此问题:未注册 COM 异常类(来自 HRESULT 的异常:0x80040154 (REGDB_E_CLASSNOTREG))?
问题描述
我试图制作一个将发送邮件的程序,但是当我尝试发送它时,我只需要解决这个问题:
COM 异常类未注册(来自 HRESULT 的异常:0x80040154 (REGDB_E_CLASSNOTREG))
这是我的代码:
Outlook.Application app = new Outlook.Application();
Outlook.MailItem mailItem = app.CreateItem(Outlook.OlItemType.olMailItem);
mailItem.Subject = "Password recovery";
mailItem.To = MailTxt.Text;
mailItem.HTMLBody = "Your new password is: " + RecoveryNewPW + ". <br/> If you want to change the password, you need to do following:<ul><li>Login and go to settings tab.</li><li>Write old password in the first textbox.</li><li>Write the new password in the second textbox</li><li>Write the new password again in the third textbox</li><li>Done!</li></ul>";
mailItem.Send();
MessageBox.Show("Sent!");
我感谢您的帮助!我知道这个问题已经存在于这个网站上,但我无法通过其他问题解决这个问题。
解决方案
推荐阅读
- sql - SQL Case 语句在 THEN 子句上增加值
- ruby-on-rails - 在 EC2 上运行 setup-ruby (GitHub Actions) 会抛出 ENOENT: no such file or directory, mkdir
- python - 熊猫从长到宽格式 - 基于 X 列中的较小值和较大值进行拆分
- c# - 哪个命名管道客户端首先连接
- python - 动态更新颜色条标题 - Plotly
- looker - 谁能帮我在 STATUS 字段上创建 Looker Alerts
- flutter - 主体可能正常完成,导致返回“null”,但返回类型可能是不可为空的类型
- windows - 无法加载流浪机器“mount -t vboxsf -o uid=1000,gid=1000,_netdev vagrant /vagrant”
- php - 如何从 php 中删除 div 类?
- javascript - 如何降低多个 if 语句的复杂性