Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
Email using Matlab

Subject: Email using Matlab

From: Bilal

Date: 9 Oct, 2010 02:21:03

Message: 1 of 9

I was wondering if it is possible to use Matlab to send files or data to a remote computer, say over the internet as an email. does anyone have any ideas or think if it's possible? If so, how?

Subject: Email using Matlab

From: Nasser M. Abbasi

Date: 9 Oct, 2010 02:24:06

Message: 2 of 9

On 10/8/2010 7:21 PM, Bilal wrote:
> I was wondering if it is possible to use Matlab to send files or data to a remote computer,
 >say over the internet as an email. does anyone have any ideas or think
if it's possible? If so, how?

May be you can look at this for some hints:

http://www.mathworks.com/matlabcentral/fileexchange/19510-sendmailgui

"A simple and convenient GUI for sending e-mail. Supports multiple
recipients and attachments. It is basically a GUI front-end for
sendmail-command."

--Nasser

Subject: Email using Matlab

From: Bilal

Date: 9 Oct, 2010 02:51:03

Message: 3 of 9

"Nasser M. Abbasi" <nma@12000.org> wrote in message <i8ojo5$5as$1@speranza.aioe.org>...
> On 10/8/2010 7:21 PM, Bilal wrote:
> > I was wondering if it is possible to use Matlab to send files or data to a remote computer,
> >say over the internet as an email. does anyone have any ideas or think
> if it's possible? If so, how?
>
> May be you can look at this for some hints:
>
> http://www.mathworks.com/matlabcentral/fileexchange/19510-sendmailgui
>
> "A simple and convenient GUI for sending e-mail. Supports multiple
> recipients and attachments. It is basically a GUI front-end for
> sendmail-command."
>
> --Nasser

That's pretty interesting, thanks. However, i want to somehow have code that will do it automatically, say when a certain condition is met. I am writing a program which continuously takes in data from a device, processes it and when certain conditions are met, I have it display a message on the screen. however, since I am away from that computer, I don't know when the messages pop up. Therefore, I want to be able to maybe email those messages to myself. That way I can view those messages from anywhere from my phone. This GUI is neat but i cant automate it...at least i dont think so.

Subject: Email using Matlab

From: Nasser Abbasi

Date: 9 Oct, 2010 03:15:27

Message: 4 of 9

On Oct 8, 7:51 pm, "Bilal " <bilalhaide...@gmail.com> wrote:

>
> > May be you can look at this for some hints:
>
> >http://www.mathworks.com/matlabcentral/fileexchange/19510-sendmailgui


"That's pretty interesting, thanks. However, i want to somehow have
code that will do it automatically, say when a certain condition is
met. I am writing a program which continuously takes in data from a
device, processes it and when certain conditions are met, I have it
display a message on the screen. however, since I am away from that
computer, I don't know when the messages pop up. Therefore, I want to
be able to maybe email those messages to myself. That way I can view
those messages from anywhere from my phone. This GUI is neat but i
cant automate it...at least i dont think so."

Sorry, did not use email in Matlab. I did what you describe above in
Java, using javax.mail. When a condition is detected, it sends email
to those on some list. I do not see why the concept should be much
different in Matlab.

But it seems to me if you can see how the email is send from Matlab,
then the rest has nothing to do with the email part itself?

You just need to detect this event, and this has nothing to do with
the email part. In the 'event handler' itself, then you can send the
email and pop a message etc...

I mean look into the code itself, posted in that GUI app, and copy the
part of the code which does the email processing.

The rest you have to do. (you have to do write some code yourself,
right? :)

--Nasser

Subject: Email using Matlab

From: Ross W

Date: 9 Oct, 2010 04:14:05

Message: 5 of 9

"Bilal " <bilalhaider87@gmail.com> wrote in message <i8olan$9t2$1@fred.mathworks.com>...
> "Nasser M. Abbasi" <nma@12000.org> wrote in message <i8ojo5$5as$1@speranza.aioe.org>...
> > On 10/8/2010 7:21 PM, Bilal wrote:
> > > I was wondering if it is possible to use Matlab to send files or data to a remote computer,
> > >say over the internet as an email. does anyone have any ideas or think
> > if it's possible? If so, how?
> >
> > May be you can look at this for some hints:
> >
> > http://www.mathworks.com/matlabcentral/fileexchange/19510-sendmailgui
> >
> > "A simple and convenient GUI for sending e-mail. Supports multiple
> > recipients and attachments. It is basically a GUI front-end for
> > sendmail-command."
> >
> > --Nasser
>
> That's pretty interesting, thanks. However, i want to somehow have code that will do it automatically, say when a certain condition is met. I am writing a program which continuously takes in data from a device, processes it and when certain conditions are met, I have it display a message on the screen. however, since I am away from that computer, I don't know when the messages pop up. Therefore, I want to be able to maybe email those messages to myself. That way I can view those messages from anywhere from my phone. This GUI is neat but i cant automate it...at least i dont think so.

You can try the Matlab sendmail function.

http://www.mathworks.com/help/techdoc/ref/sendmail.html

http://blogs.mathworks.com/loren/2010/09/16/my-first-use-of-sendmail/

Ross

Subject: Email using Matlab

From: Steven_Lord

Date: 10 Oct, 2010 05:42:10

Message: 6 of 9



"Bilal " <bilalhaider87@gmail.com> wrote in message
news:i8ojif$i3s$1@fred.mathworks.com...
> I was wondering if it is possible to use Matlab to send files or data to a
> remote computer, say over the internet as an email. does anyone have any
> ideas or think if it's possible? If so, how?

Look at the help for the SENDMAIL function.

--
Steve Lord
slord@mathworks.com
comp.soft-sys.matlab (CSSM) FAQ: http://matlabwiki.mathworks.com/MATLAB_FAQ
To contact Technical Support use the Contact Us link on
http://www.mathworks.com

Subject: Email using Matlab

From: Loren Shure

Date: 11 Oct, 2010 12:30:27

Message: 7 of 9


"Bilal " <bilalhaider87@gmail.com> wrote in message
news:i8ojif$i3s$1@fred.mathworks.com...
> I was wondering if it is possible to use Matlab to send files or data to a
> remote computer, say over the internet as an email. does anyone have any
> ideas or think if it's possible? If so, how?
Check out this blog post:
http://blogs.mathworks.com/loren/2010/09/16/my-first-use-of-sendmail/

--
Loren
http://blogs.mathworks.com/loren/
http://matlabwiki.mathworks.com/MATLAB_FAQ

Subject: Email using Matlab

From: Bilal

Date: 12 Oct, 2010 18:43:04

Message: 8 of 9

"Loren Shure" <loren.shure@mathworks.com> wrote in message <i8v013$1qg$1@fred.mathworks.com>...
>
> "Bilal " <bilalhaider87@gmail.com> wrote in message
> news:i8ojif$i3s$1@fred.mathworks.com...
> > I was wondering if it is possible to use Matlab to send files or data to a
> > remote computer, say over the internet as an email. does anyone have any
> > ideas or think if it's possible? If so, how?
> Check out this blog post:
> http://blogs.mathworks.com/loren/2010/09/16/my-first-use-of-sendmail/
>
> --
> Loren
> http://blogs.mathworks.com/loren/
> http://matlabwiki.mathworks.com/MATLAB_FAQ


This sendmail function might be what i need. However, I am having trouble getting it to work. My main problem is that i cant connect to the SMTP host. at first i thought it was because i didnt know the SMTP server name of the company, but i'm trying to send the info through my gmail account now. the info about "sendmail" said gmail is a bit different and requires the following code, modifying my address and password.


% Modify these two lines to reflect
% your account and password.
myaddress = 'myaddress@gmail.com';
mypassword = 'mypassword';

setpref('Internet','E_mail',myaddress);
setpref('Internet','SMTP_Server','smtp.gmail.com');
setpref('Internet','SMTP_Username',myaddress);
setpref('Internet','SMTP_Password',mypassword);

props = java.lang.System.getProperties;
props.setProperty('mail.smtp.auth','true');
props.setProperty('mail.smtp.socketFactory.class', ...
                  'javax.net.ssl.SSLSocketFactory');
props.setProperty('mail.smtp.socketFactory.port','465');

sendmail(myaddress, 'Gmail Test', 'This is a test message.');


I put in my gmail username and password but i get this error:

??? Error using ==> sendmail at 168
Could not connect to SMTP host: smtp.gmail.com, port: 25;
Connection refused: connect

What am i doing wrong? i took the code straight from the Mathworks website and it was specifically for Gmail. Any ideas?

Subject: Email using Matlab

From: Debejyo Chakraborty

Date: 10 Jun, 2011 14:24:05

Message: 9 of 9

When using gmail, your code works perfectly. I checked it. You might want to enable pop and imap access in the email settings of your gmail account.

"Bilal " <bilalhaider87@gmail.com> wrote in message <i92a7o$b6u$1@fred.mathworks.com>...
> "Loren Shure" <loren.shure@mathworks.com> wrote in message <i8v013$1qg$1@fred.mathworks.com>...
> >
> > "Bilal " <bilalhaider87@gmail.com> wrote in message
> > news:i8ojif$i3s$1@fred.mathworks.com...
> > > I was wondering if it is possible to use Matlab to send files or data to a
> > > remote computer, say over the internet as an email. does anyone have any
> > > ideas or think if it's possible? If so, how?
> > Check out this blog post:
> > http://blogs.mathworks.com/loren/2010/09/16/my-first-use-of-sendmail/
> >
> > --
> > Loren
> > http://blogs.mathworks.com/loren/
> > http://matlabwiki.mathworks.com/MATLAB_FAQ
>
>
> This sendmail function might be what i need. However, I am having trouble getting it to work. My main problem is that i cant connect to the SMTP host. at first i thought it was because i didnt know the SMTP server name of the company, but i'm trying to send the info through my gmail account now. the info about "sendmail" said gmail is a bit different and requires the following code, modifying my address and password.
>
>
> % Modify these two lines to reflect
> % your account and password.
> myaddress = 'myaddress@gmail.com';
> mypassword = 'mypassword';
>
> setpref('Internet','E_mail',myaddress);
> setpref('Internet','SMTP_Server','smtp.gmail.com');
> setpref('Internet','SMTP_Username',myaddress);
> setpref('Internet','SMTP_Password',mypassword);
>
> props = java.lang.System.getProperties;
> props.setProperty('mail.smtp.auth','true');
> props.setProperty('mail.smtp.socketFactory.class', ...
> 'javax.net.ssl.SSLSocketFactory');
> props.setProperty('mail.smtp.socketFactory.port','465');
>
> sendmail(myaddress, 'Gmail Test', 'This is a test message.');
>
>
> I put in my gmail username and password but i get this error:
>
> ??? Error using ==> sendmail at 168
> Could not connect to SMTP host: smtp.gmail.com, port: 25;
> Connection refused: connect
>
> What am i doing wrong? i took the code straight from the Mathworks website and it was specifically for Gmail. Any ideas?

Tags for this Thread

No tags are associated with this thread.

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us