First, I know next to nothing about coding, but...
We have a vb file that we use so users can enter requests which in turn sends emails to various distribution lists. I did not create this file, it has been here long before I arrived.
It has worked fine until now and "nobody" made any changes.
The error we get is:
error BC30516: Overload resolution failed because no accessible 'New' accepts this number of arguments. msg = New System.Net.Mail.MailMessage("itrequest#bnhc.org")
The code goes like this:
' third Message
msg = New System.Net.Mail.MailMessage("itrequest#******.org")
msg.IsBodyHtml = True
subj = "New Hire Form Confirmation"
There are two other emails before this one, both coded the same way, just different destinations.
Any help is appreciated!
If this was working before then someone definitely modified it. You are creating an Instance MailMessage() without providing all of the parameters
msg = New System.Net.Mail.MailMessage("itrequest#******.org")
lists the sending email only however MailMessage requires a sending and receiving email
Dim msg = New System.Net.Mail.MailMessage("itrequest#******.org", "recipient#google.com")
replace recipient#google.com with your email recipient and you will no longer have this issue
I hope this helps
Related
On a domino-built website I have a button that runs a lotusscript agent. Part of this agent sends emails out. Below is summary code/snippet to give you the idea of what I am doing
(only relevant lines of code):
dim sendtoString as string
dim sendtoArray as variant
sendtoString = "mailaddress1,mailaddress2" '<----- two email addresses in a string
sendtoArray = split(sendtoString,|,|)
maildoc.sendto = sendtoArray
maildoc.save(true,true) '<--- so I can look at it as a saved document
'maildoc.send(false) '<----- NOTE as of right now I am not sending, choosing to simply look at the saved version until I get this right
The strange thing is TWO documents are SAVED. I have not enabled the "send" line yet because I do not want multiple emails to be sent from the code, instead hoping the router will do this for me.
Maybe the send is going to work fine, and individuals will NOT receive multiple emails (if six email addresses are in the original string, I dont want six emails landing in each person's inbox).....and maybe I need to use the "SaveMessageOnSend" property instead.
Anyone have any insight on what is going on here?
Using LotusScript, you can generate and send email messages. When creating the email message, recipient email addresses must be assigned to the SendTo field. To send an email to a single recipient, simply set the object value to a valid email address. For example:
doc.SendTo = "someone#ibm.com"
However, when sending email to multiple recipients, you must create an array of values and append the values to the SendTo, CopyTo, or BlindCopyTo field(s). This can be achieved by building either a static or dynamic array of values.
For a full answer you can find on this blog: https://flylib.com/books/en/2.348.1/sending_email_to_multiple_recipients_using_lotusscript.html
I've got an emailing system in my application which I have used fine and have seen it working.
The customer has also managed to send emails using the program, however, once they've paid for the application, they're then selling it on to other customers.
They've just taken it in to test with the first customer and they're having troubles sending emails, so I investigated the error log and saw the following message:
The SMTP server requires a secure connection or the client was not authenticated. The server response was: 5.7.57 SMTP; Client was not authenticated to send anonymous mail during MAIL FROM [BN6PR2201CA0027.namprd22.prod.outlook.com]
Now, after Googling this exact error message, the top result was this question, in which it's clear to see that the OP was trying to send a message from an email address that was hard-coded as "emailaddress". However, that isn't the case for me.
My code is as follows:
recipient = eMail
Smtp_Server.UseDefaultCredentials = False
Smtp_Server.Credentials = New Net.NetworkCredential(senderAdd, senderPass)
Smtp_Server.EnableSsl = False
Smtp_Server.Host = SMTPserver
AddHandler Smtp_Server.SendCompleted, AddressOf sendComplete
e_mail = New MailMessage()
e_mail.From = New MailAddress(senderAdd)
e_mail.DeliveryNotificationOptions = DeliveryNotificationOptions.OnSuccess
e_mail.To.Add(eMail)
e_mail.Subject = subj
e_mail.IsBodyHtml = False
e_mail.Body = bod
Smtp_Server.SendAsync(e_mail, userState)
Is there anything in here which would be causing this error? If so, what is it?
The variables are all set from a database table, and if there are any null values then the system will pop a message box to alert the user of this and then exit the subroutine and not send the email, so it's not an issue with null values - The only thing I can think of is that the credentials are wrong, but they've supposedly been verified by 3 different people as correct.
You might need to specify the domain. Use this constructor of the NetworkCredential class and pass in the domain.
Smtp_Server.Credentials = New Net.NetworkCredential(senderAdd, senderPass, "expectedDomainName")
Difficult to say for sure though because we can't reproduce this issue under your same conditions.
I am new to a Notes environment, so I've spent a lot of time reading here and other forums in an attempt to learn how to VBA an email via Lotus/IBM Notes.
There seems to be 2 main approaches; I am using the NotesUI method, since one of the requirements for the email is to embed an image of a portion of the Excel worksheet, as well as attaching the file itself.
At this stage, I have functioning code which achieves this (more often than not!) from the email address of the person who runs the macro. I can claim no credit for this - it has been borrowed with gratitude from the web.
However, the team has a shared email account, from which I wish to send the email.
I have seen some discussion of Principal and being able to specify a FromName, but I've so far been unable to achieve this last part.
The code I am using to successfully send an email with an attachment and an image of a section of my worksheet is below - and tips on how to modify the existing code to send from another email address would be most welcomed!
Sub SendEmbedMail(mailTo As String, stSubject As String, _
copyData As Range, Optional msgBeforeEmbed As String, _
Optional msgAfterEmbed As String, Optional attachFile As Workbook)
Dim Notes As Object, db As Object, WorkSpace As Object
Dim UIdoc As Object, UserName As String, MailDbName As String
Dim AttachMe As Object, EmbedObj As Object
'Create & Open New Document
Set WorkSpace = CreateObject("Notes.NotesUIWorkspace")
Call WorkSpace.COMPOSEDOCUMENT(, , "Memo")
Set UIdoc = WorkSpace.CURRENTDOCUMENT
Call UIdoc.inserttext(mailTo)
Call UIdoc.gotofield("Body")
Call UIdoc.inserttext(msgBeforeEmbed)
copyData.CopyPicture
Call UIdoc.Paste
Call UIdoc.inserttext(msgAfterEmbed)
Call UIdoc.gotofield("Subject")
Call UIdoc.inserttext(stSubject)
If Not attachFile Is Nothing Then
Set AttachMe = UIdoc.Document.CreateRichTextItem("Attachment")
Set EmbedObj = AttachMe.EmbedObject(1454, vbNullString, _
attachFile.FullName, "Attachment")
End If
Call UIdoc.Send(0, mailTo)
End Sub
Writing the document directly to the server's mail.box file is often used as a solution for this. See the first answer to this question, and look at the code of the OpenNTF Team Mailbox project for more details. Doing this generally won't completely remove the sender's info from the message, though. (It may vary depending on the Notes and Domino versions, but Notes has never been fully cooperative with spoofing attempts done this way.)
If you want to completely hide the identity of the sender, the approach that works best is to use an agent running on the server to send the message - or in your case, to re-send it. The agent can be signed by a generic Notes id instead of the developer's or the server's id, so by the time the actual send to the actual recipient occurs, the end-user isn't part of the process. In your case, you could accomplish that by creating a mail-in database and changing your VBA code from Call UIdoc.inserttext(mailTo) to Call UIdoc.inserttext("My mail-in database name goes here") but you'll also have to put your mailTo value somewhere, otherwise the agent won't know where to re-send it. You can do that by adding a line of code like this:
Call UIdoc.Document.ReplaceItemValue("actualRecipient",mailTo)
Your agent can be set up to run after new mail arrives in the mail-in database, and it can then clean up the message by removing the From and ReplyTo and INETFrom (if they exist - see here) items, and setting the SendTo and Principal and INETFrom fields. Omitting the basic framework code for the agent (some examples here) and assuming that doc is the variable that contains the NotesDocument that you are re-sending, the actual working part of the agent could be similar to this:
doc.RemoveItem("From")
doc.RemoveItem("InetFROM")
doc.RemoveItem("ReplyTo")
if doc.hasItem("actualRecipient") then
doc.ReplaceItemValue("SendTo",doc.actualRecipient(0))
doc.RemoveItem("actualRecipient")
else
' here you'll want to do something sensible if a message arrives in the mail-in
' database but it doesn't have an actualRecipient; i.e., it wasn't sent by your
' VBA code!
End if
Call doc.ReplaceItemValue("Principal","support#company.com#Your Notes Domain Goes Here <support#company.com>")
Call doc.ReplaceItemValue("INETFrom", "support#company.com")
Call doc.Send()
You could also do this using back-end classes (not UI). I wrote a class to help with creating emails, it includes changing the from-address to anything you like:
http://blog.texasswede.com/lotusscript-mail-notification-class/
You just have to add a method to insert a picture in the text, you can use the approach described by Thomas Hampel at http://blog.tomcat2000.com/blog/tomcat2000.nsf/dx/notesapi-import-pictures-into-richtext-fields-using-backend-classes.htm.
I have an SSIS package that detects test domains from a data set being passed through the pipeline. I use a Scripting Component to send an e-mail notification listing the domains that have been marked as test domains. When I first posted the package with the notification, it sent a separate e-mail for each domain, after receiving to many e-mails, I changed the script to send a single e-mail with a list of the test domains. However each time I publish this update, it continues to send a single notification for each test domain.
Things I have looked into:
The content of the first e-mail and the second e-mail are different. So I did a "Find in Files" search in Notepad++ to see if I could find where the original e-mail content might be stored. There were no results found containing the original content.
I have disable the step which sends the notifications and published the package. This results in no notification e-mails being sent. However when I re-enable the step and publish, the original notifications sending a single e-mail for each test domains starts again.
I have tried dropping the SQL job that executes this package and recreating it but still the original notifications come through.
So with no trace of the original content even found on the production server, I do not know where this is coming from. I don't see anything about where the content could be cached, but even if it was being cached, then when I disabled the notification step, it would have still sent the notifications.
I am worried that if this can't be fixed, then does this mean there are other packages that are not being fully updated?
Any ideas or help would be greatly appreciated.
This is pretty much how the Scripting Component is setup...
Public Class ScriptMain
Inherits UserComponent
Private strDomains As String = String.Empty
Public Overrides Sub PreExecute()
MyBase.PreExecute()
End Sub
Public Overrides Sub PostExecute()
If strDomains.Length > 0 Then
Dim myHtmlMessage As MailMessage
Dim mySmtpClient As SmtpClient
Dim strMessageBody As New StringBuilder
strMessageBody.AppendLine("The listed domains have blah blah blah...")
strMessageBody.Append(strDomains)
strMessageBody.AppendLine(String.Empty)
strMessageBody.AppendLine("Love and Kisses,")
strMessageBody.AppendLine("Your Loving ETL Package")
strMessageBody.AppendLine(Variables.PackageName)
myHtmlMessage = New MailMessage("ETLNotices#company.com", "me#company.com", "Possible Test Domains", strMessageBody.ToString)
mySmtpClient = New SmtpClient("smtp.company.com")
mySmtpClient.Credentials = CredentialCache.DefaultNetworkCredentials
mySmtpClient.Send(myHtmlMessage)
End If
MyBase.PostExecute()
End Sub
Public Overrides Sub Input0_ProcessInputRow(ByVal Row As Input0Buffer)
Dim str As New StringBuilder
str.AppendLine(strDomains)
str.AppendFormat("{0}", Row.DomainName)
strDomains = str.ToString
End Sub
End Class
Chris,
I have some questions:
I guess you are using looping mechanism in your script task to iterate through all the domains ; find test ones among them; append them to a string and at the end send out an email. Is this correct?
Are you sending the mail in the script or created a separate Send Mail task?
Is the body of the your mail coming from some variable from config file?
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?