"MailTo" & Windows 10 Mail client in VB - vb.net

My VB app can send an email to myself using the following code format:
Process.Start("mailto:test#myself.com&subject=somesubject&body=somebodytext")
This works well with email clients so far except Windows 10 Mail. For Mail the entire string is saved to the "To" line. What am I missing please?
"To" line: "test#myself.com?subject=somesubject&body=somebodytext"
Also, how best to test for Mail being the email client?

Related

Using VBA to change body content of an outlook 2010 email that was sent

I sent an email using Outlook 2010 and after sending the email it was stored in the default Sent Items folder.
I would like to use VBA code to search for a string in the recently sent email and replace the string with a different string.
Can you suggest code that would do it?
GetDefaultFolder Method
myNamespace.GetDefaultFolder(olFolderSent)
Find & Replace Text -
Item.Body = Replace(Item.Body, "BlaBla", "Replacement text Here")

Access sending emails via SMTP

I have the following basic Send Object Macro.
Function McrSnapshotCallData()
On Error GoTo McrSnapshotCallData_Err
DoCmd.SendObject acQuery, "Qry_SnapShot", "Excel97-Excel2003Workbook(*.xls)", "xxx#xxx.com", "", "", "Calls", "Please find attached", False, ""
McrSnapshotCallData_Exit:
Exit Function
McrSnapshotCallData_Err:
MsgBox Error$
Resume McrSnapshotCallData_Exit
End Function
I need to be able to send run this macro on a server using a scheduler enabling an email to be sent out.
Currently this requires and outlook account on the server and it does not have one. Is it possible to include SMTP server details so this can be run automatically without me having to log on every night and send this.
Please can you me help adjust this if possible.
Sorry I am not very good with VBA stuff. Thanks
I can recommend these tools:
Blat: http://www.blat.net/ (free)
Blat is a Windows (32 & 64 bit) command line utility that sends eMail using SMTP.
Chilkat ActiveX libraries: http://www.chilkatsoft.com/email-features.asp (not free, but a lot more options)
MailMan: The Chilkat MailMan class is reponsible for sending email though SMTP and receiving/managing email on POP3 servers.
Email: Represents a complete Email object.
In both cases you'd first save the query as xls (DoCmd.TransferSpreadsheet) and then mail that file.

vsto outlook get account email address which received email

Consider this situation: in my outlook I have two accounts my_name#gmail.com (default) and my_nyme#hotmail.com . If someone sends one e-mail message to booth my addresses I’ll end up with two email in my outlook inbox. Is it possible (using VSTO for Outlook) to differentiate which email message was received for gmail.com domain and which for yahoo.com?
I have this
String emailAddress = Globals.ThisAddIn.Application.Session.CurrentUser.Address;
but it's always my_name#gmail.com. If I iterate Outlook.MailItem.Recipients I’ll get booth my email address and can’t resolve which of them is true recipient.
Use the MailItem.SendUsingAccount property - it will point to the account used to receive the message.

Invalid Mail Attachment

I have a windows service that sends out emails by retriving the records from the database. The service account Windows Service is running under, is a Local admin on that machine. The issue i am having is somehow the windows service manages to send out some emails with pdf attachements that exist on the local server where windows service is located and for most of them i get an error message: Invalid Mail Attachment and having real difficulties what could be causing it? any idea on where should i start looking please?
Thanks
Try
' Initialize new mail message class
Dim objEmailMessage As New System.Net.Mail.MailMessage(EmailOutboxEntity.EmailFrom, EmailOutboxEntity.EmailTo)
' Set the email parameters
objEmailMessage.Subject = EmailOutboxEntity.EmailSubject
objEmailMessage.Body = EmailOutboxEntity.EmailBody
' Check if attachments have been specified
If Not EmailOutboxEntity.TestOriginalFieldValueForNull(EmailOutboxFieldIndex.EmailAttachements) Then
' Get an array of attachment file names to send
Dim arrAttachment As String() = Split(EmailOutboxEntity.EmailAttachements, CONST_AttachmentSeparator)
' Step through each filename and attach it to the email
For Each strAttachment As String In arrAttachment
' Attach the current file to the email
objEmailMessage.Attachments.Add(New System.Net.Mail.Attachment(strAttachment))
Next
End If
' Set the SMTP server
Dim mailServer As New System.Net.Mail.SmtpClient(pstrSMTPServer)
' Send the message
mailServer.Send(objEmailMessage)
Catch errException As Exception
' Throw an exception indicating the email failed to send
Throw New EmailOutboxManagerException(errException.Message, "Test Failed to send email, got the following error instead:")
End Try
Sorry Guys, as i have figured out the answer and it was my fault because i was running two different versions of the windows service on different servers and they were both picking up the attachments from the database and the path existed on one server where the files were saved and not on the other server and that's why some of the emails were managed to be sent.

SMS though VB.NET, proper from address

I am writing a web interface paging system. The main function of the system is to send SMS messages to cell phones and pagers, which I have accomplished this using email. However, when I send a message, the from address comes up as a string of 10 numbers. The actual from address is in the message.
Here's my code:
Dim mailMessage As New MailMessage()
Dim client As New SmtpClient(gateway)
mailMessage.From = New MailAddress(fromAddress)
mailMessage.Body = tbMessage.Text
mailMessage.To.Add(New MailAddress(toAddress))
client.Send(mailMessage)
The last email I sent to my phone turned up this:
From: 1410000033
Message:
FRM:email#provider.com
MSG:test
This is really annoying to anyone who gets paged because of all the random numbers in their message box instead of the actual address I sent the message from. This is also annoying because the from address uses a good bit of characters.
I have looked around and it looks to be a ATT gateway issue. The phone I've been testing this on is ATT. I do have a coworker with a Verizon phone and it appears to work fine.
Does anyone have any ideas on what I can do to correct this problem?