Sending an sms and email in Visual Basic - vb.net

I'm developing a college project in which I'm providing user with a facility to send an SMS and email to its client.
How can I do this in VB or VB.NET ????

Haven't done SMS, but here is email using Mail.MailMessage
Dim mlItem As New Mail.MailMessage
mlItem.From = New Mail.MailAddress("me#mydomain.com", "Me")
mlItem.To.Add(New Mail.MailAddress("you#yourdomain.com", "You"))
mlItem.Subject = "My Email"
mlItem.Body = "How are you?"
Dim mlClient As New Mail.SmtpClient("smtpserver")
mlClient.DeliveryMethod = Mail.SmtpDeliveryMethod.Network
mlClient.UseDefaultCredentials = False
mlClient.Credentials = New NetworkCredential("username", "password", "fqdn")
mlClient.Send(mlItem)
mlClient = Nothing
mlItem = Nothing

I have a .NET library that will send text messages through Twilio (where I work) in 2 lines of code:
Dim twilio As New TwilioApi("youraccountsid", "yourauthtoken")
twilio.SendSmsMessage("555-111-1111", "555-222-2222", "Sending SMS in .NET with Twilio is easy!")

Sending emails is quite easy, just look at the System.Net.Mail namespace. This documentation for the SmtpClient class has an easy sample.
The easiest way to setup sending SMS would probably be to use an email - SMS gateway, that way you could just send an email for that as well.
Otherwise, here's an SMS gateway that has some sample code for sending SMS via them from VB.Net. (Note, I've no knowledge of that supplier except that they had that sample on their site.).

Related

I have a problem with InlineKeyboardButton in python telegram API

This is what my bot will do:
If someone sends a command like \sendFriendReq to my bot, then my bot will send a message with their details and an Inline Button with with "yes" and "no".
The problem I'm facing: How can i know who send those messages other than formatting the text with their details, is there a way to send their chat id along with the inline button so i can use that chat id to send a reply to my bot users
Disclaimer: This is not the actual problem but the solution to this problem could solve my problem so alternate solution to send friend req won't help me
This would give you pretty much every detail about the incomming message:
userid = update.message.from_user.id
firstname = update.message.from_user.first_name
lastname = update.message.from_user.last_name
fullname = update.message.from_user.full_name
username = update.message.from_user.name
message = update.message.text
chatid = update.message.chat_id

How to set cloud based SMTP details in ASP.NET Core MVC

I have send email functionality in my code and I have cloud based SMTP details like follows
SMTP Server:xxxxxxxxx
SMTP User:xxxxxxxx
SMTP Password:xxxxxx
SMTP Port:25
SMTP Enable SSL:true
but in the c# we required to set following details
MailAddress to = new MailAddress("<email address>");
MailAddress from = new MailAddress("<email address>");
MailMessage mail = new MailMessage(from,to);
but I have cloud based system's SMTP details and don't have from email Id therefore the code is throwing an error that from email is must.
Any solution for it?

ASP: SMTP authentification fails with JMail

I have a bit specific problem. One of the websites I am taking care of runs on ASP and obtains form, whose results are e-mailed to specific address.
For this to achieve, JMail component is used. As long as e-mail was sent locally (let say to user#clientserver.com through mailserver mail.clientserver.com), there was no problem and no need for authentication. However I recently got request to add another address to copy(copy#differentserver.com) and that's when problem occurred.
Firstly I tried adding authentication, however same error still occurred, when without:
jmail.Message error '8000ffff'
The message was undeliverable. All servers failed to receive the message
I tried google solutions, temper with some valuables. I am sure user and pass are correct, mail server address also worked when I wasn't try to sent mail with authentication.
Since I prefer PHP, my knowledge and skill with ASP are not of the bests. Have someone experienced something similar and solved it? Or does anyone know some other solution?
The code, which is used for sending mail:
set msg = Server.CreateOBject( "JMail.Message" )
msg.Charset = "windows-1250"
msg.Logging = true
msg.From= "from#mail.com"
msg.FromName= name&" - "&mail
'those should care of smtp auth
msg.MailServerUserName = "smtpuser#localmailserver.com"
msg.MailServerPassword = "smtppass"
'local mail address
msg.AddRecipient "user#localmailserver.com"
'outside mail address
msg.AddRecipient "address#differentmail.com"
msg.Subject = "Some subject"
msg.Body = "Some text"
if not msg.Send( "mail.localmailserver.com" ) then
Response.write "<pre>" & msg.log & "</pre>"
else
'Succesfully sent, redirect
Response.Redirect("mailjob_sent.asp")
end if
So the problem is solved at last. After help with analysis by my colleagues responsible for local mailserver, we found out, the problem was username for SMTP authentification.
I got confused, since it wasn't smtpuser#localmailserver.com (I'm referring to example I made), but
smtpuser#localdomainname.com.
So advice for others with similar problem, try to add testing account(one you are using for authentification) to your e-mail client(i.e. Thunderbird) and once that is allright, you have right credentials. Also try sending mail from that account elsewhere.

Interfax developer account configuration for multiple recipients

I want to configure an interfax account for sending and receiving faxes.
Can anyone tell me how to send/receive a test fax?
I know about the .sendFax() and .GetList() methods, but how do I send fax to myself (in test account)?
I followed the article,
Receive incoming faxes via callback to a web application
it works fine. But it only gives you intimation that you have received fax.
Edit:
You can set feedback url and use the parameter which they asked. When interfax will receive fax for you, it will send it to your feedback url and it will go directly to your database (If you set this in page load event).
You can use following code
MessageItem[] faxList = null;
Inbound inbound = new Inbound();
ListType messageListType = ListType.NewMessages;
int interFaxResult = inbound.GetList(AppConfig.InterfaxUsername, AppConfig.InterfaxPassword, messageListType, AppConfig.InterfaxMaxitems, ref faxList);
if (interFaxResult == 0)
{
// Save faxes in DB
}

How to check email using a vb.net application

I am looking for a vb.net code for receiving e-mails without using any 3rd party libraries. I want to check Unread messages, Inbox and Sent messages. A Working sample is appreciated.
What is the default port for SMTP , is it port 25 (is it the same for all SMTP mail servers?). Which is more flexible in my case POP3 or IMAP ?
Edit:
Someone please give me a sample working code for receiving mail using lumisoft (pop) in vb.net
From lumisoft Help.
/*
To make this code to work, you need to import following namespaces:
using LumiSoft.Net.Mime;
using LumiSoft.Net.POP3.Client;
*/
using(POP3_Client c = new POP3_Client()){
c.Connect("ivx",WellKnownPorts.POP3);
c.Authenticate("test","test",true);
// Get first message if there is any
if(c.Messages.Count > 0){
// Do your suff
// Parse message
Mime m = Mime.Parse(c.Messages[0].MessageToByte());
string from = m.MainEntity.From;
string subject = m.MainEntity.Subject;
// ...
}
}
Pop is more supported and most servers have it on if you want to implement your own pop service a good place to start is the rfc.