Get the App
SLTechnology News&Howtos  ›  Internet Technology  › 

How to use matlab to send email

Shulou Source: shulou.com Published: 2022-06-01 06:31:05 10月04日 Update

This article is to share with you about how to send email using matlab. The editor thinks it is very practical, so share it with you as a reference and follow the editor to have a look.

The sendmail function in matlab can help us achieve this function.

Usage:

Sendmail (recipient mailbox, title)

Sendmail (recipient's mailbox, title, information)

Sendmail (recipient's mailbox, title, message, attachment name)

Note:

1. For a single recipient, specify the recipient as a character vector or string. For multiple recipients, specify the recipient as a character vector cell array or a string array. The title must be a character vector or string.

two。 If the information is a character vector or string, sendmail automatically wraps the text at 75 characters. To force line wrapping in the message text, use 10, as shown in the example. If the information is a character vector cell array or a string array, each element represents a new line of text.

3. The attachment name can be a character vector, a character vector cell array, or a string array.

In general, it is not possible to use sendmail directly, because the sendmail function does not support e-mail servers that require authentication. So you also need to do the following operation

1. You need to enable the smtp service of your mailbox first. Take QQ Mail as an example

Open the account under QQ Mail's settings

And then turn down and find this.

Open the red box, click Open and do what it says. Finally, you will get an authorization code, remember this authorization code, and then the first step will be completed.

two。 Use the setpref function to specify these settings

Setpref ('Internet','E_mail',My_Mail)

% My_Mail is your own email address

Setpref ('Internet','SMTP_Server','smtp.qq.com')

If it is 163mailbox, then the last string is smpt.163.com

Anyway, the characters after @ and .com in the mailbox are placed in smpy. In between and .com

3. Use the following forms of commands to change your system settings and set presets for SMTP usernames and passwords:

Props = java.lang.System.getProperties

Props.setProperty ('mail.smtp.auth','true')

Setpref ('Internet','SMTP_Username',My_Mail)

% My_Mail is your own email address

Setpref ('Internet','SMTP_Password',My_Password)

% My_Password is your authorization code

Then you can happily use sendmail to send email.

Sendmail ('* @ qq.com', 'title', 'Information', 'PicInformation.xls')

Thank you for reading! This is the end of the article on "how to use matlab to send email". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, you can share it for more people to see!

Tags: Characters mailboxes vectors strings recipients arrays messages titles messages functions text content that is more articles attachments help services no not bad Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno vpn Microsoft Linux Shulou Technology MariaDB