Monday, September 30, 2013

Send Email via Visual Basic

Greetings,

tah berapa bulan la dah tak on belog sepot nih...
kinda busy + malas + takda cerita nk share + etc....

so, hari ni seems like ada masa free..n I thought nk put some 'info' in my blogspot..next time takde la tercari2 lagi tutorial...hehe..
so, this is for me, and you and for all...

this is programming things...
untuk send email guna visual basic.
so here is it..



1) kene Imports 2 tu.
2) declare the variables
3) start lah process create email..

  • mail.subject = ini subject utk email
  • mail.To.Add = address penerima
  • mail.From = New MailAddress ... yg ni email penghantar..
  • mail.Attachments.Add (  if ada nk attach, masukkan dlm kurungan ni )
  • mail.Body = this is the place utk korg tulis segala mcm ..
4)  Now, process penghantaran pun bermula...
  • EnableSsl ni untuk access specific smtp mail server.
  • smtp.Credentials ni pula, kene masukkan ID and Password si penghantar email..klu tak mcm mne nk send email kan?
5) Naaa.. last skali smtp.Send(mail)... is like envelop .. akan simpan semua dan hantar..hehe..

note:-
utk step credentials tu... utk some cases, mail tak dpt nk send sbb ada prob nk send to non-local server.
contoh klu guna port sekian2, tak leh nk send email ke yahoo,gmail etc... sbb itu port utk server tetentu..
therefore.. utk overcome this obstacle, ID kene penuh..
if email " something2share@yahoo.com" .. then.. kene le set yg penuh tu as ur ID... 


okay, yg ni semua on coding side..so utk sender & recipient email address tu akan jd static..
klu nk yg boleh tuka2, kat design mode tu, guna la textboxes..n declare textboxes ya..

til next time..

No comments:

Post a Comment

LinkWithin

Related Posts Plugin for WordPress, Blogger...