PS script that emails after completion?
Hello, I have this script it's suppose to mail the PS document:
Header 1
var mailServer = "mail_Server_name";
var mailAddress = "E-Mail-Address";
var mailTitle = "Results of script";
var mailText = "Script completed at " + new Date();
printText = false; //True print results to Console.
sendmail(mailServer, mailAddress,mailTitle,mailText);
function sendmail(mailServer, mailAddress,mailTitle,mailText){
var sObj = new Socket();
if (sObj.open(mailServer+":25")) {
sObj.writeln("HELO "+mailServer);
var txt = sObj.read()+"\n";
sObj.writeln("MAIL From: " + mailAddress);
txt += sObj.read()+"\n";
sObj.writeln("RCPT To: "+mailAddress);
txt += sObj.read()+"\n";
sObj.writeln("DATA");
sObj.writeln("From: Photoshop");
txt += sObj.read()+"\n";
sObj.writeln("To: "+mailAddress);
txt += sObj.read()+"\n";
sObj.writeln("Subject: "+mailTitle);
txt += sObj.read()+"\n";
sObj.writeln(mailText);
txt += sObj.read()+"\n";
sObj.writeln(".");
txt += sObj.read()+"\n";
sObj.writeln("QUIT");
txt += sObj.read()+"\n";
if(printText) $.writeln(txt);
sObj.close();
I have it at the end of a previously working script. It does not give me any errors or anything but it also doesn't do anything. I filled in the variables for my email/results etc...and I tried ismtp.gmail.com for the mail_server_name. I think that is my problem, I'm not entirely sure what mail_server_name should look like.
Any help would be appreciated. If you have another script that does the same thing I'd love to see it.
-Sam
Bump - any help at all? I'm trying to automatically email this to tumblr...maybe that helps?
Similar Messages
-
Help with bash script that fails after suspend to RAM
I have a very simple reminder script that uses an endless loop, sleep and zenity to pop up a reminder every twenty minutes:
#!/bin/bash
while true;
do
sleep 20m
zenity --warning --title="Ergonomics Reminder" --text="Check Posture or Have a Stretch!"
done
However, it does not work as it should after suspending to RAM. I am thinking I need to kill the process and restart it after every suspend, using a "thaw" notice in /etc/pm but if there is an easier way to do it please let me know!I'm doing this for 2 reasons:
- as a scripting exercise
- because the local repo is a shared wordpress mess and people forget to make commits so I'd like a local backup that includes all changes that may not be in github (sadly).
Anyhow, thanks for the input about trap, I'm definitely confused by it's use at this point but have reworked the script without it.
#!/bin/sh
set -e #Exit on any error.
TIME=`date +"%m.%d.%Y@%H:%M:%S"` # Define the TIME variable as today's date and time.
MONTH=`date +"%b"` # Define MONTH as today's month.
FILENAME="backup-$TIME.tar.gz" # Define the filename structure.
SRCDIR="/stuff" # Define folder to backup.
DESDIR="/Backup/$MONTH/" # Define the backup folder location.
LOGFILE="$DESDIR/backup-$TIME.log" # Store the output in a log.
REMOTE=$(git ls-remote -h origin master | awk '{print $1}') # Get commit hash from head of remote master repo (github)
LOCAL=$(git rev-parse HEAD) # Get commit hash from head of server repo (dev/test)
if [[ $LOCAL == $REMOTE ]]; then # If the hashes match
echo "No update required." >> $LOGFILE # Then no pull is needed
else # If the hashes don't match then prepare to run our backup
mkdir -p $DESDIR # Create our directory if it doesn't exist.
echo "Backup started for "$TIME >> $LOGFILE # Make it log what it's doing.
tar -cpzf $DESDIR/$FILENAME $SRCDIR >> $LOGFILE 2>&1 # Perform the backup.
echo "Backup Finished for "$TIME >> $LOGFILE # Log that it's finished.
echo "Preparing for git pull " >> $LOGFILE #Log what we're doing.
cd /stuff >> $LOGFILE 2>&1 # Make sure we're in our repo directory
git pull >> $LOGFILE 2>&1
echo "Git pull completed successfully. " >> $LOGFILE
mail -s "Backup log `date`" [email protected] < $LOGFILE # Email the output to me.
fi -
Form Button running Script that does not complete Progress Bar
Hello,
Currently I have created a form using the System.Reflection.Assembly which includes a textbox and button. The button calls a script with a progress bar using the write-progress method, but when the progress bar completes it does not go away.
Any assistance is appreciated. As the code is quite long and in several files I have posted some of the code below.
[void] [System.Reflection.Assembly]::LoadWithPartialName("System.Drawing")
[void] [System.Reflection.Assembly]::LoadWithPartialName("System.Windows.Forms")
$getVMware = Join-Path -path $ScriptPath -ChildPath "bin\get-vmhosts.ps1"
Add-PSSnapin VMware.VIMAutomation.Core -ErrorAction SilentlyContinue
$objForm = New-Object System.Windows.Forms.Form
$objForm.Text = "VMware Script - Created by Walter Beach"
$objForm.Size = New-Object System.Drawing.Size(650,390)
$objForm.StartPosition = "CenterScreen"
$AuditButton = New-Object System.Windows.Forms.Button
$AuditButton.Location = New-Object System.Drawing.Size(310,80)
$AuditButton.Size = New-Object System.Drawing.Size(75,23)
$AuditButton.Text = "Audit"
$AuditButton.Add_Click({ get-vmhosts | set-vmdnsservers -DNS $DNS })
$objForm.Controls.Add($AuditButton)
Function set-vmdnsservers
param
[Parameter(ValueFromPipelineByPropertyName=$true)]$Name,
[Parameter(Mandatory=$true,HelpMessage="Example: 192.168.1.1")]$DNS
$i = 0
$itemCount=$input.Count
write-host ""
Write-Host "Configuring DNS Server " -NoNewline
$Input | ForEach {
IF ($PSVersionTable.PSVersion.Major -ge 3) { Write-Progress -activity "Configuring DNS Servers" -status $_ -PercentComplete (($i++ / $itemCount) * 100) } Else { ticker }
$_ | Get-VMHostNetwork | Set-VMHostNetwork -DnsAddress $DNS | Out-Null
} # End For Each Loop
} # End of set-vmdnsservers
WalterYou need to put a final call to Write-Progress with the -Completed switch, probably right after your ForEach loop, in this case:
$Input | ForEach {
IF ($PSVersionTable.PSVersion.Major -ge 3) { Write-Progress -activity "Configuring DNS Servers" -status $_ -PercentComplete (($i++ / $itemCount) * 100) } Else { ticker }
$_ | Get-VMHostNetwork | Set-VMHostNetwork -DnsAddress $DNS | Out-Null
} # End For Each Loop
Write-Progress -Activity "Configuring DNS Servers" -Completed -
So, I placed my order by 3:35 AM EST for my Silver 6 plus 128GB. All the way through the process, from selecting the phone to the submission confirmation screen on the web it stated delivery by 9/19. I received my email confirmation and that showed the order date as 9/12 and the delivery date as 9/12. Well I knew that would not be right.
So then I go online to check the order status and it states the order has been received and the expected SHIP date is 10/14. WHAT?!?
So I called Vz and spoke with a rep who stated that he wasn't sure why it showed that but my ship date would be 9/19. Call #1
Well that's fine, I knew he probably mixed those words up.
So then I check on 9/13 to see if it was updated online, still showed 10/14. So I call again and this time the Vz rep places me on hold then comes back and says I am sorry to say that your expected ship date is 10/14. Flustered and irritated I ask how that can happen and change from all the other notices stating the 19th (or sooner according to the email which she laughed about). Call #2
So today, I decide to check again after Noon EST and now all day it has said that the expected ship date is NOT AVAILABLE?
Checking this community, looking at tweets and posts I see all conflicting information, some people getting getting ship notices but most of those are just the 6 and not the plus.
Where can I find a straight answer. I have seen another poster state that anyone who completed their order the first couple hours of ordering on the 12th will definitely receive on the 19th according to what they have been told by a Vz rep but honestly with the mixed messages I have seen personally I am not putting a lot of faith in what was told to him.
OH, also I can only check my order by my preorder confirmation and not my order number. When trying to check with my order number it gives an error message saying that is not a valid number.
I have been a customer for almost 20 years, and this is making me think about switching.We know everyone is super exited about these great phones. As your order moves through the process, you can check the status at http://bit.ly/RjmCUB. You may not be able to see a change from Processing until it officially ships, then you'll see the tracking number. If you've received a confirmation email that your order was submitted, any additional information throughout the fulfillment process will be sent to that same email address.
TrevorC_VZW
Follow us on Twitter @VZWSupport -
Membership form that redirects to paypal after completion
I am looking to start a membership scheme on our website. What I want to do is have a membership form which will be filled out with the clients information (eg email, address, name, telephone) which is then sent to our email once completed and the client is then redirected to our paypal page where they can make their membership payment. I am basically looking to be able to do something similar to this - http://www.lancasterhistory.org/index.php?option=com_content&view=article&id=2348&Itemid=2 60. What would be the best way to recreate something like that?
http://www.lancasterhistory.org/index.php?option=com_content&view=arti cle&id=2348&Itemid=260.
Is that a floored concept? Someone fills out the details and sends them to your email address and only then gets directed to paypal to make a payment. They then decide against it and you have unwanted details being posted to your email.
Unless I'm mistaken and the details only get sent to the email AFTER a payment is made via pay pal but I can't see that because you can't change the paypal code as far as I'm aware.
Just posing the question as I'm too am considering payment options for a Memebership page. -
On my iPad I have a working icloud that I have complete access to, but on my iPhone it keeps asking me for the password for it, but I do not know it! And the email that I used is not activated anymore! How do I delete the icloud account on my phone?
Hi Aurion23,
If you intend to keep using iCloud on your iPad, your best course of action would be to update your Apple ID/iCloud information so that you have a known password and it is associated with an active email address. You may find the following articles helpful:
iCloud: Change your iCloud password
http://support.apple.com/kb/ph2617
Apple ID: Changing your Apple ID
http://support.apple.com/kb/ht5621
Regards,
- Brenden -
Hi guys,
I was hoping there might be a feature or add-on that will allow me to automatically print an email after I send it. For the purpose of creating a paper trail we have to print out at least the 1st page of all emails sent to our clients. Love using Thunderbird and would like to keep using it. I know there is a feature in Outlook. Hope you guys have one too :)There is an add-on, [https://addons.mozilla.org/en-US/thunderbird/addon/send-filter/ Send Filter], that allows filters to act on the Sent folder, and there is an add-on, [https://addons.mozilla.org/en-US/thunderbird/addon/filtaquilla/ FiltaQuilla], that adds Print to the filter Actions. I can't confirm whether or not you can get them to work together to achieve your aim.
-
I have an iPhone 4s that is no longer active on my account. I recently upgraded it after completing a 2-year contract. Is it still possible for me to have the iPhone 4s unlocked even though it is no longer active on my account?
Great question missmar23. You can contact our Global Support department at 1-800-711-8300 to discuss the details for your device.
KinquanaH_VZW
Follow us on Twitter @vzwsupport -
While dealing with an external hardware i got a Java update4 request,but was not able to complete that update.After that when i switch on my Mac it shows reinstallation required.i was working with OSX 10.8.5,but after reinstallation now it is 10.7.5 .And while doing search for update it shows your software is uptodate..
Hi Hal,
One possibility, is a strange occurence when applying the big 10.5.8 combo, most people have to Repair Permissions twice in a row, then reboot. -
Script that will warn users after 9 minutes of idle
If i have a group policy to lock screen set for 10 minutes. what would be the best way to have a pop up or notification that will appear when the workstation is about to lock in 20 seconds
in order to help the users?
From what i can tell i can not implement the message part in group policy. I'm thinking some type of script that literally warns the user after 9 minutes and 40 seconds of idle time. Seems like the easiest way to do it would be in a log on script.
How should i go about doing this? Please advise> Would I have to create the task on every client computer?
Basically: Yes. It's just a matter of HOW you create the task :)
I'd suggest using
https://technet.microsoft.com/library/cc725745.aspx
Greetings/Grüße,
Martin
Mal ein
gutes Buch über GPOs lesen?
Good or bad GPOs? - my blog…
And if IT bothers me -
coke bottle design refreshment (-: -
I've forgotten the end of my ePrint email address, i.e. the part that comes after the @ sign. Help!
Hi,
Shoule be @hpeprint.com
Regards.
BH
**Click the KUDOS thumb up on the left to say 'Thanks'**
Make it easier for other people to find solutions by marking a Reply 'Accept as Solution' if it solves your problem. -
I am using apple configerator. I am unable to prepare or supervise 1 ipad. After preparing, I get an error that says "refresh completed but with an error, unable to verify supervision state" . I have erased all content and set up as a new ipad and tried again with no success. Any help would be appreciated
Hello jaybearden,
Thanks for the question. After reviewing your post, it sounds like you are not able to restore the iOS device since you get an error 9. I would recommend that you read this article, it may be able to help the issue.
Resolve iOS update and restore errors - Apple Support
Check your security software
Related errors: 2, 4, 6, 9, 1000, 1611, 9006. Sometimes security software can prevent your device from communicating with either the Apple update server or with your device.
Check your security software and settings to make sure that they aren't preventing a connection to the Apple servers.
Thanks for using Apple Support Communities.
Have a nice day,
Mario -
Ihave aol and cannot acesss my email after updating to osx 10.6. the help says that I need mail 4.6. I have 4.5. How do I get the correct version?
Run all software updates.
http://support.apple.com/kb/TS4424 -
Script that will help validate if there is any data loss after a DB restore
Hi,
I need to write a single script that will perform the following
operations:
1)return me the highy accessed tables across all databases.
2)List the count, Min and Max system date of the highy accessed tables returned from step 1.
The idea is to validate if there is any data loss to the highly transactional tables after a database restore operation has been performed.
Thanks.Hello,
I would also like you to see nice blog by Aron,you can modify the script a bit to change according to your need
http://sqlblog.com/blogs/aaron_bertrand/archive/2008/05/06/when-was-my-database-table-last-accessed.aspx
Please mark this reply as the answer or vote as helpful, as appropriate, to make it useful for other readers
Hello Shanky,
The post would not be helpful too much for OP's requirement. The post was talking about when was the database last accessed. DMLs are not capturing in the script and also there will be many variant forms that can be applied for DML. Hence, I do not think,
the script would help too much.
Or Am I missing something?
Latheesh as i mentioed OP has to modify the script little bit may be add User_seek,user_update,user_scans.Still IMO there is no *perfect* way to actually analyze this.So I pointed out point in my original post.Also unless he has some timestamp he cannot
see min time when it was accessed ,max time can be taken from last user seek,scan,lookup time. Motive was to lethim know what he was trying to achieve cannot be axactly obtained by using sys.dm_index_usage_stats.Below query will give most accessed table
: Source (Query)
SELECT
t.name AS 'Table',
SUM(i.user_seeks + i.user_scans + i.user_lookups)
AS 'Total accesses',
SUM(i.user_seeks) AS 'Seeks',
SUM(i.user_scans) AS 'Scans',
SUM(i.user_lookups) AS 'Lookups'
FROM
sys.dm_db_index_usage_stats i RIGHT OUTER JOIN
sys.tables t ON (t.object_id = i.object_id)
GROUP BY
i.object_id,
t.name
ORDER BY [Total accesses] DESC
Please mark this reply as the answer or vote as helpful, as appropriate, to make it useful for other readers -
Question
firefox has detected the server is redirecting the request for this address in a way that will never complete. This is happening in my email program with comcast but does not happen with IE e editThanks to cor-el for the suggestion given in the link. Sadly I have to report:
1) It is not a bookmark problem and it makes no difference whether I put
www.adobe.com or 192.150.18.117 in the address bar.
2) Cookies are allowed and there are no exceptions set
3) All cookies have been deleted
4) network.http.sendRefererHeader is already set to 2
That deals with the items in the linked document.
Additional information:
5) I can get into the adobe site from a clean "in memory" installation of PuppyLinux using Seamonkey using the same router and dhcp setup.
6) un-installing all Mozilla products - rebooting and re-installing makes no difference even when I remove the mozilla folder from docs&settings.
so as I said in previous post (as annonymous) not a lot makes sense.
Bear in mind that I have no problem running tracert in a command window
Tracing route to www.adobe.com [192.150.18.117] over a maximum of 30 hops:
1 11 ms 10 ms 9 ms 10.0.0.1
2 13 ms 12 ms 11 ms glo-2-dsl.as9105.net [212.74.111.191]
3 13 ms 12 ms 11 ms ge1-2-27.glo0.as9105.net [212.74.106.106]
4 14 ms 12 ms 13 ms pos0-0.bri1.as9105.net [212.74.108.162]
5 17 ms 16 ms 17 ms ge0-0-0.he-lon0.as9105.net [212.74.109.14]
6 17 ms 17 ms 16 ms 10.72.11.75
7 16 ms 17 ms 17 ms xe-0-3-0-10.lon20.ip4.tinet.net [213.200.77.177]
8 91 ms 92 ms 99 ms xe-5-1-0.was12.ip4.tinet.net [89.149.184.34]
9 92 ms 92 ms 93 ms xe-0.equinix.asbnva01.us.bb.gin.ntt.net [206.223.115.12]
10 162 ms 170 ms 162 ms as-3.r20.snjsca04.us.bb.gin.ntt.net [129.250.2.167]
11 166 ms 166 ms 165 ms ae-1.r07.snjsca04.us.bb.gin.ntt.net [129.250.5.53]
12 162 ms 163 ms 161 ms xe-0-2-0-3.r07.snjsca04.us.ce.gin.ntt.net [128.241.219.86]
13 166 ms 163 ms 161 ms 192.150.18.11
14 166 ms 166 ms 165 ms www.adobe.com [192.150.18.117]
Trace complete.
and I can ping the site.
so where now ?
Maybe you are looking for
-
Word Templates for Office:mac
I am trying to locate the Legal templates for MS word that are compatable with Office:mac. My search of the Microsoft downloads website came up with nothing. In fact the few templates I found were more along the lines of novelties rather than the ful
-
Error in Proxy to SOAP synchronous scenario
Hi Gurus, Hope you are doing well. I have a Proxy to SOAP synchronous interface interacting with an external system (system outside the firewall/landscape of my company). When I am trying to post the request message from XI, I am getting the followin
-
I got a HDTV LCD TV for X-mas last year and just recently it has been getting this gray line along the top of the display and then the picture gets kinda distorted. I looked all over for information but unfortunately,like normal, I can not get my que
-
Service Manager 2012 R2 - Workflow Error - Event ID 4513
Hi, We started to suffer a Workflow error in Service Manager 2012 R2 2 weeks ago. We noticed through the failure of some SLOs not being applied on Work Items. The error is the follow: Log Name: Operations Manager Source: HealthService Dat
-
Customizing setting 'Recalculate depreciation for previous years'
Dear Experts, I have requirement where for tax depreciation areas we want the system to recalculate the depreciation for previous years. For e.g. Asset acquired on 7/1/06 with value 10000 Useful life: 5 years Take over date in asset accounting: 9/30/