Mengirim Email Dengan GUI Matlab


Pada dasarnya, syntax untuk mengirim email melalui Matlab adalah :

sendmail(recipients,subject)
sendmail(recipients,subject,message)
sendmail(recipients,subject,message,attachments)


Anda bisa menggunakan salah satu syntax dibawah ini :
Contoh 1 :

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.')

Contoh 2 :

sendmail('user@otherdomain.com','New subject', ['Line1 of message' 10 'Line2 of message' 10 'Line3 of message' 10 'Line4 of message']);

Contoh 3 :
Mengirim file dengan attachment/lampiran

sendmail('user@otherdomain.com', 'Test subject','Test message', {'folder/attach1.html','attach2.doc'});

Jika anda ingin menggunakan GUI, pada dasarnya menggunakan script yang sama, namun anda harus membuat tombol yang anda buat berfungsi dengan cara menggunakan fungsi Callback.
[youtube:http://www.youtube.com/watch?v=5-XdiXZpG20%5D

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s