Logging into and sending email automatically - vba

I have an autoexec macro to send an email if a condition is met.
I would like this email to come from a specific email address no matter who opens the database.
I have the email account and password, but I'm not sure how to (or if it's even possible) to sign into an email account and send the email through VBA.
Solutions I've seen involve using .SendUsingAccount, however, that requires the user to be signed into the email account. Preferably, signing into the account would be done within the VBA so it doesn't matter if a user is logged into the account.

Use CDO and send via SMTP to the server of the mail account:
VBA – CDO Mail

Related

Outlook 2021, how to write a trigger that change "From" field for speciffic account on every "Create Mail", "Reply", "Forward" event

In Outlook 20xx there is no way to change From field automatically. There are ways to have multiple accounts and use a default one all the time, but not when you reply. This is anti-feature by design and I'm forced to use Outlook with Exchage server using user emails (so every user has his own storage) but sending as office accounts (and when recieving email a copy is forwarded to users which are in office group) [eg. robert#company.com is real account, but when sending/reply/forward it should be sales#company.com]. There are many examples on using macros for all sort of things but not this one.
I need 3 triggers that change From field without clicking some special custom button
when I click New Email
when I click Reply on some selected email
when I click Forward on some selected email
thnx.
added exchange user account, then added exchange office account, set office account as default, options -> mail -> send messages -> always use default account when composing new messages
This was the nearest goal but worked only for new messages, on reply it allways default to user account.
The email profiles are Exchange profiles/accounts and have the required permissions to send on behalf of another person (eg. office#company.com)

Is it possible to hide email account details while authenticating using MailKit?

While authenticating our email account using MailKit (VB.net), as below code
clientIMAP.Authenticate("email#address.com", "myPassword")
Is it possible to "hide" my email address and password? This is because I am not the only who who will access the source code,, and I don't really wanna show my account details to the others.
Was thinking on creating an email account just for this project purpose, but still wants to know if there is any other way.

AWS SES bounced/complain email handle

We have some issues related with AWS SES bounce and complain emails,
and we send send emails on these conditions. these conditions are as follows:
1) When new user registered, 2) When user forget his/her password and 3) When he/she purchased any video from ourplatform. To send email we have implemented AWS SES mail service and successfully managed to send email from AWS SES. But here I have some doubt to handle Bounced and Complaint email. According to this post on stackoverflow:
Handle hard bounces / complaints or just stick to suppression list?
We have managed list of emails in our database, when new user 1st time registered into our platform and getting notification for bounced and complaint notifications from AWS SNS. But here are some case I want to discuss with you:
Bounce: When user 1st time registered into our platform and his/her email does not exist i.e. jm123#gmail.com in that case we save his/her email into our bounced email list, but when 2nd time he creates a email with the same email id ( jim123#gmail.com ) and want to register with our platform again then how we will remove that email from list because we have already black listed that email in our platform.
Complaint: In 2nd case when user accidentally put our platforms email as spam when we send him/her a email and getting complaint notifications for that email and for complaint emails we have managed list of complaint emails and saved that email in this list so that same user can not get email from the next time but after some time that user white list us from spam and wants our email notifications.
Note: Is this necessary to handle all bounced or complaint email into our database because randomness of emails are infinite and for all random emails we have to handle into our database. and before send emails to any new registered user, 1st we have to process our bounced and complaint emails list then we will decide the user is eligible to receive our email or not.
Sorry for my bad English.
The StackOverflow Question you linked to covers this in the Answer.
Yes, you should maintain your own database table of at least some of the permanent bounced emails, something like:
record ID (auto increment), email address, bounce type: invalid mailbox | user complaint | rejected for content | rejected for spam blacklist
Bounce: "when 2nd time he creates a email with the same email id ...
how we will remove that email from list because we have already black
listed that email in our platform?"
When the user tries to add the email, you query the email address in your table, you see the type is "invalid mailbox", and then reject it as invalid. You could possibly also log the IP address to catch spammers trying to create fake accounts.
Complaint: "... but after some time that user white list us from spam
and wants our email notifications."
When the user tries to add the email, you query the email address in your table, you see the type is "user complaint", and maybe ask them "are you sure?" before adding them back to your mail list. You change the type of the email in your database to something like "user confirmed OK to send"
You could also just add one extra field to your existing mailing list table to hold the bounce type, with the default type being 0 / OK / not bounced. Then when sending email you skip sending emails where the type is not 0 / OK.
But in hard bounced if user will have valid email address after put
his email address in table and he/she wants our subscription then how
we could handle
You could allow them to re-add the address and set the type back to 0, but this might be a fake address like "fake#fakefake.com."
If you want to let them do this you could have a second field "times bounce was cleared" and add +1 each time the address is set back to 0 / OK / mail allowed. If this counter reaches 3-5 you never let them add the email again. They must use a different email.
what about soft bounce
"Transient" (soft) bounces should be ignored. SES will try again later and if it still fails then you will get a hard bounce.

Is there any way to detect if a Twitter user verified their email address?

I have a whitelisted Twitter app that can request and receive email address of a twitter account when the owner of the account accepts and logs in through my app.
Now, I plan to connect it to my already available "Sign-up/Login by email" flow seamlessly.
The problem is, logged in Twitter user may not have verified their email account. In that case they can hijack a user on my system who signed-up with that email.
Therefore, I have to be sure that they have verified their email address. Otherwise I have to automatically send a confirmation link to the email address of the just-signed-in twitter user.
Is there any way to detect if the user confirmed their email address on Twitter? If not, what is the general solution to this problem? At least, how do you solve it for yourselves?
I found out that if the user does not verify their email address, Twitter will not return the email address even though it is there. So, if you receive an email address from Twitter, that should mean that the email address of the user is verified.
If anyone finds that this is not correct, please leave your comment or your findings.
Twitter returns a 0 length string in field email if user didn't verify his email.
...
translator_type: 'none',
email:''}

send email from a Microsoft exchange Imap account from MailCore

Ok, so I am building an app that gets and sends emails from your email account, but I have hit a brick wall, the app worst great for POP3 accounts and IMAP accounts, but if are using a exchange IMAP account from a Microsoft Exchange server then it will let you log in and grab the unread emails, but not send anything, this is what i use to send an email
[CTSMTPConnection sendMessage:outMessage server:[dictData valueForKey:#"SMTPServerName"] username:[dictData valueForKey:#"userEmailAddress"] password:[dictData valueForKey:#"password"] port:[[dictData objectForKey:#"SMTPPort"]intValue] useTLS:NO useAuth:YES];
And yes obviously the "username" is not always the email address. I have tried all different types of combinations of setting for the "useTLS" and "useAuth" part (YES/NO, NO/YES, YES/YES, NO/NO). I keep getting an error message back from mailcore saying the "username or password is invalid." --- this only happens when i try sending an email from that account
It is better (and more stable) to use separate SMTP class based on NSSockets
which does the same work as MailCore SMTP client.
NSSocket-based class will be more readable in locking for server connection errors.
We use MailCore only as IMAP part in our mail project.