send-mailmessage remove corporate default signature - powershell

When I do this:
Send-MailMessage -To 'user#domain.com' -From 'test#domain.com' -Subject 'testsubject' -Body 'testbody' -SmtpServer 'smtp.domain.com'
I get the email with no signature (as desired).
However, when i do this:
Send-MailMessage -To '1234567890#vtext.com' -From 'test#domain.com' -Subject 'testsubject' -Body 'testbody' -SmtpServer 'smtp.domain.com'
I get the message on my phone with from, subject, and body, but at the end of the message there is a line of _ followed by what appears to be a corporate standard email signature.
Is there any way to prevent that from being included in the message?
Or, is there any way to change the corporate email signature?

This sounds like a transport rule on the server. You can't control what the smtp does to your mail.
The only thing I could think of is to try and sign it using s/mime. Hopefully the rule on the smtp ignores signed mails to avoid breaking them (integrity-signature not matching the content), It's worth a try.
I would contact the administrators and ask for that particular mailaddress to be excluded from the rule.

Related

Preventing spam from php mail

I have made a new website for learning web development and I was taught to use the php mail function to send emails. When I use the following code in the headers to send an email to my gmail address:
$headers = "MIME-Version: 1.0" . "\r\n";
$headers .= "Content-type:text/html;charset=UTF-8" . "\r\n";
$headers .= 'From: <admin#myWebsite.com>' . "\r\n";
I noticed that the email has a question mark next to it and gmail says: "Gmail couldn't verify that myWebsite.com actually sent this message (and not a spammer)." Is there any way to prevent this from happening?
As for my second question; I noticed that when I changed the last line of the header to:
$headers .= 'From: <admin#someOtherWebsite.com>' . "\r\n";
The email still gets sent like it came from another person's domain. (Although with the same warning mentioned above). But if the header is changed to:
$headers .= 'From: <admin#gmail.com>' . "\r\n";
Then no email is sent. So can someone tell me what is google doing to prevent others from using php mail to send fraudulent emails using their domain?
Your mail server isn't configured as tight as it could be.
You should make sure that SPF records are set for your domain, that you have proper Reverse DNS for the name your mail server uses in its HELO statement, and set up and use SSL for SMTP (ESMTP), easy to do with a letsencrypt cert.

Unexpected email - x-newtrunsreceiver header

Struggling to find any useful information on this, so I'm hoping some light may be shed here.
I received an email to which I don't appear to have been addressed.
It's a legitimate email to our organisation, however there appears to be no reason for it to be delivered to me. Digging through the headers DOES reveal my email address, in a header field x-newtrunsreceiver.
ie.
x-sender: sender#sendersemail
x-newtrunsreceiver: legitimaterecipient1#ourorg
x-newtrunsreceiver: myemail#ourorg
x-newtrunsreceiver: legitimaterecipient2#ourorg
The recipients legitimaterecipient1 and legitimaterecipient2 are in the To: and Cc: fields respectively.
I am kind of assuming I've been BCc'd, but can't find any info on what the x-newtrunsreceiver header field is / does.
Any help welcomed.
MIME headers have absolutely nothing to do with who actually receives the message.
When a message is submitted to an SMTP server, the recipients are specified in the "RCPT TO" SMTP command. The MIME headers that follow the DATA command can contain anything. The SMTP server can in theory take a look at the To and CC headers, but there is absolutely no requirement or reason to do that.
Now the receiving SMTP server can add an extra header (e.g. Apparently-To), but, again, it has no obligation to do that.

Locate the location for entering from email address

I have a simple Contact form, with 'Send' button', that send mail from an email to an email.
In the local host with wamp server i have done it and it's working.
I have used 'fake email program' to send it, I entered the from email in the 'sendmail.ini' file.
How can i achieve the same goal using plesk service as a server, where can I enter the from email address?
It sounds like a simple task but I have just spent over an hour looking for it.
i have an contact.html form with php for serer code, what i am trying to do is to send the contact.html form details that the user has filled to an external email, In local host i managed to do it but know when i uploaded to server I am having trouble to locate the 'from email address field' (where i can setup the email address to emails that are going out from the site).
Suppose you own a site and some user fill the 'contact us' form, You as the site owner will receive an email from your site with the user details that the user filled in the contact form.
This code is from my php file #mail($email_to, $email_subject, $email_message, $headers);
and by using 'wamp server' on 'my local computer' and external fake email sender program,
I filled up this file with my 'email from address' (sendmail.ini) with this lines:
'smtp_server=smtp.gmail.com', 'smtp_port=25' and 'authentication' details: username= my_name#gmail.com And password='mypassword' for that email.
This is what i am looking for in 'plesk' server desk The location of that ini file where i can enter the from address, smtp_port and authentication details.
This is how I do it with PHP and the Mail() function:
$headers = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=utf-8' . "\r\n";
$headers .= 'Content-Transfer-Encoding: 8bit' . "\r\n";
$headers .= 'From: MyName <' . $from . '>' . "\r\n";
mail($to, $subject, $html, $headers);
$from = from email
$to = to email
$html = email body
$subject = email subject

My Emails sent through PHP shows as tags only for a few recipients (sending a few hundred)

Im sending out an order conformation for recipients via the simple mail function built into PHP, and this works fine. It's a "nice" email set up in tables and a few styles with the details in it
However a few of the recipients just see html tags, and of course can't understand anything..
If i get one, it shows perfectly in thunderbird, hotmail, gmail..
The html is perfect, not missing any end tags, and i send some headers also as i have read i should. this is my mail send function:
$body = "some html tags, set up in a table" ;
$sendto = "The recipients email here" ;
$subject = "subject here" ;
$headers = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1'."\r\n";
$headers .= "To: theemailhere <theemailhere>\r\n";
$headers .= 'From: <thefromemailhere>' . "\r\n";
mail($sendto, $subject, $body, $headers);
Is this an error from my side, or has the recipient chosen not to receive html emails? I mean is this still possible in 2012 and do people disable this??
And if so, what could be a good workaround to do this. I mean i would like to avoid using plain text.
Yes. There are really email clients which do not allow HTML emails. I guess older Outlooks are one of these, too, but not sure.
So, anyway, it is not your fault, it is the user's. See Source 1 and Source 2.
And you can never be sure what does the user's mail program accept. Only plaintext is surely accepted. Quoting Source 2:
"The best you can do is anticipate how each of the major clients will
break your design, and then try to control how it breaks, so that it’s
still readable by most of your recipients."
It can be solved only with multipart messages, but then some people will get plaintext. See Source 3 for some details on the issue and Source 4 for solutions.
Some documents on this: Source 1, Source 2, Source 3, Source 4
I've been using Zend_Mail recently (from ZF), which has the option to set a plain text message, and then a HTML message which overrides it where HTML is available. I'm unsure of how this is implemented in the message (headers/etc.) but this could be an answer to your problems.

Perl, Unix Email: download csv in browser issue

I have this:
open(MAIL,"|/usr/sbin/sendmail -t");
## Mail Header
print MAIL "To: $GLOB_OPT{email}\n";
print MAIL "From: $GLOB_OPT{from}\n";
print MAIL "Subject: $GLOB_OPT{sub}\n";
print MAIL qq|Content-Type: text/html; charset=us-ascii\n|;
print MAIL qq|Content-Transfer-Encoding: 7bit\n|;
print MAIL qq|MIME-Version: 1.0\n\n|;
print MAIL qq|<h3>Download File :</h3><br>|;
print MAIL qq|Click Here|;
close(MAIL);
I want to send the hyperlink to user so they can download the csv file in the $GLOB_OPT{html} path.
When I open the link in my email, it opens the csv in the browser. I want instead the browser to download the file. What can i do?
Try using content-disposition in http headers on the webserver's side. This even works with .htaccess.
As far as I understand, the way you send the e-mail has little to do with the save/display choice in the browser.
Don't use the system sendmail command. Instead use the MIME::Lite module.
They have a coding example that pretty much does exactly what you want to do.
This way, you're not depending upon an external command that may or may not work (depending upon the system and its configuration).
You could output the CSV via a script which sends to the browser first mime-header "application/octet-stream" instead of the default
MIME type sent by apache(or the used server). You can also configure the server to send the header it self by associating the .csv extension with "application/octet-stream" mime type.
see also The apache docs